コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void AwardLeaveCreditsToEmployee_WhenAwardedPreviously_ShouldNotAwardLeaveCreditsOfThatYear()
        {
            empStub.FindItem(Arg.Any <int>()).Returns(new Employee()
            {
                DateHired             = new DateTime(2015, 8, 10),
                RemainingLeaveCredits = 30M
            });
            timekeepingStub
            .QueryItem(Arg.Any <Expression <Func <Timekeeping, bool> > >())
            .Returns(new Timekeeping());     //we give QueryItem an instantiation to know that timekeeping is already awarded for 2 years.

            Employee result = timekeepingService.AwardLeaveCreditsToEmployee(Arg.Any <int>());

            //Employee result = service.AwardLeaveCreditsToEmployee(Arg.Any<int>());


            //Assert.AreEqual(30, result.RemainingLeaveCredits);
            Assert.AreEqual(30M, result.RemainingLeaveCredits);
        }