Пример #1
0
        public void CreateStaff_GivenValidArguments_StaffEventIsCreated()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                var staffRepository = new Mock<IStaffRepository>();
                var lookupValueRepository = new LookupValueRepositoryFixture();

                var staffFactory = new StaffFactory(staffRepository.Object, lookupValueRepository);

                var agency = new Mock<Agency>();

                StaffProfile staffProfile =
                    new StaffProfileBuilder().WithStaffName(new PersonNameBuilder().WithFirst("Fred").WithLast("Smith"));

                Staff staff = staffFactory.CreateStaff(agency.Object, staffProfile);

                AssertStaffEventCreation(staff, lookupValueRepository);
            }
        }
Пример #2
0
        private void AssertStaffEventCreation(Staff staff, LookupValueRepositoryFixture lookupValueRepository)
        {
            Assert.IsTrue(staff.StaffEvents.Count() == 2);

            staff.StaffEvents.ForEach(
                se =>
                Assert.IsTrue(lookupValueRepository.GetAllStaffEventTypes().Any(allStaffEvents => allStaffEvents.Name == se.StaffEventType.Name)));
        }
Пример #3
0
        private void AssertStaffChecklistCreation(Staff staff, LookupValueRepositoryFixture lookupValueRepository)
        {
            Assert.IsTrue(staff.StaffChecklist.Count() == 2);

            staff.StaffChecklist.ForEach(
                sc =>
                    {
                        Assert.IsTrue(
                            lookupValueRepository.GetAllStaffChecklistItemTypes().Any(allSc => allSc.Name == sc.StaffChecklistItemType.Name));
                        Assert.IsTrue(!sc.CheckedIndicator);
                    });
        }