jeudi 1 septembre 2016

How to verify that mock object was "gotten"?

Is there a way to assert that my mocked object was "gotten" ?

public class Car
{
    private readonly IValidationDict _validationDict;
    public Car(IValidationDict validationDict)
    {
        _validationDict = validationDict;
    }

    public void Go()
    {
       var myValidation = _validationDict;   //I would like to assert that _validationDict was indeed assigned to another variable or "gotten"
    }
}

In my unit test I would have something like:

var mock = new Mock<IValidationDict>();
var sut = new Car(IValidationDict.Object);

Is there a way to assert that my mocked object was "gotten" ?

Aucun commentaire:

Enregistrer un commentaire