mercredi 3 août 2016

Moq returning an object from a method

I have the following unit test and I'm using MOQ to set-up an object returned from a class. However when I try to reference mock.Object it is referencing the interface type not the type that I'm trying to return

var throughFareIdentifer = new ThoroughfareNumberIdentifier();

var throughfareMock = new Mock<ILLUSiteInformation>();
 throughfareMock.Setup(x => x.GetThroughfareNumber("15")).Returns(throughFareIdentifer);


var siteInformation = _lluSiteInformation.GetSiteDetails("", "", "", "", "", "", "", "", throughfareMock.Object);

throughfareMock.Object should be ThroughfareNumberIdentifier not IlluSiteInformation.

any help with this would be appreciated

thanks

Chris

Aucun commentaire:

Enregistrer un commentaire