I have a code in my .cs file like below
public IfileGroup Placefile(int quantity, IfileGroup destfile, ILoc location)
{
fileGroup fg = null;
cg = this.TransferFile(quantity, destfile as fileGroup, location);
}
So In my test file I created mock object like this
Mock< IfileGroup > frp = new Mock< IfileGroup >();
frp.Setup(x => x.FileInfo).Returns("FileAvailable");
Mock<ILoc> locationMock;
locationMock.Setup(x => x.fileLocationId).Returns("10");
and calling the function
fileGroup target = new fileGroup ();
var result = target.Placefile(4, frp.Object, locationMock.Object);
but while debugging, when control goes to function “Placefile” it makes destfile as null, is there any way to down caste from mock object to original C# object ?
Aucun commentaire:
Enregistrer un commentaire