public void CheckManamager_GetFee_Test_Count() { //arrange var Person = new List <Person>() { new Person { Gender = GenderOption.Male }, new Person { Gender = GenderOption.Female }, new Person { Gender = GenderOption.Female } }; var mock = new MockRepository(); var FeeManager = mock.StrictMock <IFeeManager>(); //act using (mock.Record()) { FeeManager.GetFee(Person[0]); LastCall.IgnoreArguments().Return(1000m).Repeat.Times(2); } //assert using (mock.Playback()) { var Check = new CheckManamager(FeeManager); decimal nResult = Check.GetFee(Person); } }
public void CheckManamager_GetFee_Test() { //arrange var Person = new List <Person>() { new Person { Gender = GenderOption.Male }, new Person { Gender = GenderOption.Female }, new Person { Gender = GenderOption.Female } }; var FeeManager = MockRepository.GenerateStub <IFeeManager>(); FeeManager.Stub(x => x.GetFee(Arg <Person> .Matches(y => y.Gender == GenderOption.Male)) ).Return(500); FeeManager.Stub(x => x.GetFee(Arg <Person> .Matches(y => y.Gender == GenderOption.Female)) ).Return(100); //act var Check = new CheckManamager(FeeManager); decimal nResult = Check.GetFee(Person); //assert Assert.AreEqual(700, nResult); }