I am using NUnit to test my application with method as
public int POCRemainingUnits()
{
var units = _transportService.GetUnits(x => x.Shipment.Id == shipmentId && x.POCAllowed == true && x.IsPOC == false, 0);
int POCUnitCount = units.Count();
//
//
}
And My test Method is something like
[Test]
public void Invoke_POCUnitCommand_As_Many_Times_As_Number_Of_Remaining_Units_With_Valid_Input()
{
//arrange
var unit1 = new Unit { IsPOC = false, POCAllowed = true };
var unit2 = new Unit { IsPOC = false, POCAllowed = true };
IQueryable<Unit> units = (new Unit[] { unit1, unit2 }).AsQueryable();
_transportServiceMock.Setup(y => y.GetUnits(x => x.Shipment.Id == 1 && x.POCAllowed == true && x.IsPOC == false, 0)).Returns(units);
//
//
}
But its failing as it is not setting the GetUnits methods.If I check the count in POCRemainingUnits, it still returns zero.Can anyone please suggest me what I am doing wrong.
Thanks In Advance