public void VacationNotificationServiceTests_WithDeniedStatus_EmailNotifyStatusChange_Denied_Test()
        {
            var emailer = new Common.Notification.Fakes.StubIEmailer()
            {
                InstanceObserver = new StubObserver()
            };
            var templatesRepository = new Common.Notification.Fakes.StubIEmailTemplatesRepository();
            var employeesRepository = new Data.Repositories.Fakes.StubIEmployeeRepository();

            employeesRepository.GetInt32 = (id) =>
            {
                return(new Employee()
                {
                    EmployeeId = id,
                    FirstName = "My",
                    LastName = "Employee",
                    Email = "*****@*****.**"
                });
            };

            VacationNotificationService service         = new VacationNotificationService(emailer, templatesRepository, employeesRepository);
            VacationRequest             vacationRequest = new VacationRequest()
            {
                Status = VacationRequestStatus.Denied
            };

            service.NotifyStatusChange(vacationRequest, string.Empty);

            var observer = (StubObserver)emailer.InstanceObserver;

            Assert.AreEqual(1, observer.GetCalls().Count(c => c.StubbedMethod.Name == "Send"));
        }
        public void VacationNotificationServiceTests_NotifyNewVacationRequest_Test()
        {
            var emailer = new Common.Notification.Fakes.StubIEmailer()
            {
                InstanceObserver = new StubObserver()
            };
            var templatesRepository = new Common.Notification.Fakes.StubIEmailTemplatesRepository();
            var employeesRepository = new Data.Repositories.Fakes.StubIEmployeeRepository();

            employeesRepository.GetInt32 = (id) =>
            {
                return(new Employee()
                {
                    EmployeeId = id,
                    FirstName = "My",
                    LastName = "Employee",
                    Email = "*****@*****.**",
                    Team = new Team()
                    {
                        Manager = new Employee()
                        {
                            FirstName = "Manager",
                            LastName = "LastName",
                            Email = "*****@*****.**"
                        }
                    }
                });
            };

            VacationNotificationService service         = new VacationNotificationService(emailer, templatesRepository, employeesRepository);
            VacationRequest             vacationRequest = new VacationRequest()
            {
                EmployeeId = 1
            };

            service.NotifyNewVacationRequest(vacationRequest);

            var observer = (StubObserver)emailer.InstanceObserver;

            Assert.AreEqual(1, observer.GetCalls().Count(c => c.StubbedMethod.Name == "Send"));
        }