Пример #1
0
        public void CanGetListOfPersonEventsForAGroup()
        {
            var eventRepository = MockRepository.GenerateStub<IEventRepository>();
            var eventList = new List<PersonEventDto> { new PersonEventDto(), new PersonEventDto(), new PersonEventDto() };
            var currentPerson = new Person {Permissions = new List<int> {57}};
            eventRepository
                .Expect(e => e.GetPersonEventsForGroup(1, currentPerson))
                .Return(eventList);

            var permissionRepository = new PermissionRepository();
            var personRepository = new PersonRepository(permissionRepository, new ChurchRepository());
            var usernamePasswordRepository = new UsernamePasswordRepository(permissionRepository);
            var groupRepository = new GroupRepository();
            var messageRepository = new MessageRepository();
            var messageRecepientRepository = new MessageRecepientRepository();
            var messageAttachmentRepository = new MessageAttachmentRepository();
            var emailSender = new EmailSender(messageRepository, messageRecepientRepository, messageAttachmentRepository, personRepository);
            var churchEmailTemplatesRepository = new ChurchEmailTemplatesRepository();
            var emailContentRepository = new EmailContentRepository();
            var emailContentService = new EmailContentService(emailContentRepository);
            var emailService = new EmailService(usernamePasswordRepository, personRepository, groupRepository, emailSender, emailContentService, churchEmailTemplatesRepository, permissionRepository);
            IEventService eventService = new EventService(eventRepository, emailService, new BirthdayAndAniversaryRepository());

            var sut = eventService.GetPersonEventsForGroup(1, currentPerson);

            Assert.That(sut.Count(), Is.EqualTo(3));
        }
 public GroupEventsController()
 {
     var birthdayRepository = new BirthdayAndAniversaryRepository();
     var permissionRepository = new PermissionRepository();
     var personRepository = new PersonRepository(permissionRepository, new ChurchRepository());
     var usernamePasswordRepository = new UsernamePasswordRepository(permissionRepository);
     var groupRepository = new GroupRepository();
     var messageRepository = new MessageRepository();
     var messageRecepientRepository = new MessageRecepientRepository();
     var messageAttachmentRepository = new MessageAttachmentRepository();
     var emailSender = new EmailSender(messageRepository, messageRecepientRepository, messageAttachmentRepository, personRepository);
     var churchEmailTemplatesRepository = new ChurchEmailTemplatesRepository();
     var emailContentRepository = new EmailContentRepository();
     var emailContentService = new EmailContentService(emailContentRepository);
     var emailService = new EmailService(usernamePasswordRepository, personRepository, groupRepository, emailSender, emailContentService, churchEmailTemplatesRepository, permissionRepository);
     var eventRepository = new EventRepository(birthdayRepository);
     _eventService = new EventService(eventRepository, emailService, birthdayRepository);
 }
Пример #3
0
        public HomeController()
        {
            var permissionRepository = new PermissionRepository();
            var churchRepository = new ChurchRepository();
            _personRepository = new PersonRepository(permissionRepository, churchRepository); var birthdayRepository = new BirthdayAndAniversaryRepository();
            var personRepository = new PersonRepository(permissionRepository, new ChurchRepository());
            var usernamePasswordRepository = new UsernamePasswordRepository(permissionRepository);
            var groupRepository = new GroupRepository();
            var messageRepository = new MessageRepository();
            var messageRecepientRepository = new MessageRecepientRepository();
            var messageAttachmentRepository = new MessageAttachmentRepository();
            var emailSender = new EmailSender(messageRepository, messageRecepientRepository, messageAttachmentRepository, personRepository);
            var churchEmailTemplatesRepository = new ChurchEmailTemplatesRepository();
            var emailContentRepository = new EmailContentRepository();
            var emailContentService = new EmailContentService(emailContentRepository);
            _emailService = new EmailService(usernamePasswordRepository, personRepository, groupRepository, emailSender, emailContentService, churchEmailTemplatesRepository, permissionRepository);
            var eventRepository = new EventRepository(birthdayRepository);
            _eventService = new EventService(eventRepository, _emailService, birthdayRepository);
            _personGroupRepository = new PersonGroupRepository(_personRepository);
            _usernamePasswordRepository = new UsernamePasswordRepository(permissionRepository);

            _photoRepository = new PhotoRepository();
            _photoServices = new PhotoServices();
            _personService = new PersonService(
                _personRepository,
                new PersonGroupRepository(_personRepository),
                permissionRepository,
                new PersonRoleRepository(),
                new PersonOptionalFieldRepository(),
                new RelationshipRepository(_personRepository),
                new ChurchMatcherRepository(),
                new GroupRepository(),
                new FamilyRepository(_photoRepository),
                _emailService,
                new AddressRepository(),
                _photoRepository
                );
        }