public void Init() { uowStub = Substitute.For <IUnitOfWork>(); empDeduStub = Substitute .For <IGenericRepository <EmployeeDeductions> >(); empStub = Substitute.For <IGenericRepository <Employee> >(); timekeepingStub = Substitute .For <IGenericRepository <Timekeeping> >(); timekeepingService = new TimekeepingService(empStub, timekeepingStub, uowStub); }
public void AwardLeaveCreditsToEmployee_Should_AwardLeaveCredits() { var service = new TimekeepingService(empStub, timekeepingStub, uowStub); empStub.FindItem(Arg.Any <int>()).Returns(new Employee() { DateHired = new DateTime(2015, 8, 10) }); Employee result = service.AwardLeaveCreditsToEmployee(Arg.Any <int>()); Assert.AreEqual(30, result.RemainingLeaveCredits); }
public void AwardLeaveCreditsToEmployee_WhenAwarded_AddsTimekeepingEntry() { var service = new TimekeepingService(empStub, timekeepingStub, uowStub); empStub.FindItem(Arg.Any <int>()).Returns(new Employee() { DateHired = new DateTime(2015, 8, 10) }); service.AwardLeaveCreditsToEmployee(Arg.Any <int>()); int result = service.stubTimekeepingLists.Count; //Employee result = service.AwardLeaveCreditsToEmployee(Arg.Any<int>()); //Assert.AreEqual(30, result.RemainingLeaveCredits); Assert.AreEqual(2, result); }