//WE test this by examining the criteria that "DDLForStaff" was called with[Test]
public void TestMethod1_criteriaWithPropertyOfCtrIdGreaterThan0(){
// Test created by powershell on 02/15/2013 14:32:30//*** Arrange***StaffProfilesRptVM TestCriteria = new StaffProfilesRptVM() { CtrId = 15 };
//*** BLL and DAL Stubs ***mockSelfTestDALHdl.Stub(x => x.DDLForStaff(TestCriteria)).IgnoreArguments().Return(new List<DDLDispValueCV>(){});
//*** Act ***selfTestBLLHdl.TestMethod1(TestCriteria);
IList<object[]> args = mockSelfTestDALHdl.GetArgumentsForCallsMadeOn(db => db.DDLForStaff(Arg<StaffProfilesRptVM>.Is.Anything));StaffProfilesRptVM finalVal =
new StaffProfilesRptVM();
if (args != null && args.Count > 0){
finalVal = (StaffProfilesRptVM)(args[0][0]);
}
//*** Assert ***Assert.AreEqual(finalVal.CtrId, 22);// Even though i set the ctr_id as 15, it should be called with 22, if i entered this if cluase.
}
No comments:
Post a Comment