Esempio n. 1
0
        public void Init()
        {
            var dataMocks = new DebRegDataMocks();
            IUnitOfWork unitOfWork = dataMocks.UnitOfWork;
            ISlotAssignmentManager slotAssignmentManager = new SlotAssignmentManager(unitOfWork);
            IBookingManager bookingManager = new BookingManager(unitOfWork);

            DebRegUserManager userManager = dataMocks.UserManager;
            ITournamentManager tournamentManager = new TournamentManager(unitOfWork, userManager);

            var communiationMocks = new DebRegCommunicationMocks();
            IEMailService emailService = communiationMocks.EMailService;
            ITournamentRegistrationsManager tournamentRegistrationsManager = new TournamentRegistrationsManager(unitOfWork, emailService, userManager);
            ISlotManager slotManager = new SlotManager(slotAssignmentManager, tournamentRegistrationsManager, tournamentManager, bookingManager, emailService, userManager);

            SecurityMocks securityMocks = new SecurityMocks();
            IAuthenticationManager authManager = securityMocks.AuthManager;
            ISecurityManager securityManager = new SecurityManager(userManager, authManager);
            IOrganizationManager organizationManager = new OrganizationManager(unitOfWork, userManager);
            SlotController slotController = new SlotController(
                unitOfWork, 
                tournamentRegistrationsManager, 
                slotAssignmentManager, 
                slotManager, 
                organizationManager, 
                tournamentManager,
                userManager);
        }
Esempio n. 2
0
        public void Init()
        {
            var dataMocks = new DebRegDataMocks();
            DebRegUserManager userManager = dataMocks.UserManager;
            SecurityMocks securityMocks = new SecurityMocks();
            IAuthenticationManager authManager = securityMocks.AuthManager;
            ISecurityManager securityManager = new SecurityManager(userManager, authManager);

            var unitOfWork = dataMocks.UnitOfWork;

            ICountryManager countryManager = new CountryManager(unitOfWork);
            ITournamentManager tournamentManager = new TournamentManager(unitOfWork, userManager);

            var communicationMocks = new DebRegCommunicationMocks();

            userController = new UserController(
                dataMocks.UnitOfWork,
                new TournamentRegistrationsManager(dataMocks.UnitOfWork, communicationMocks.EMailService, dataMocks.UserManager),
                new SendMail(communicationMocks.EMailService),
                new OrganizationManager(dataMocks.UnitOfWork, dataMocks.UserManager),
                userManager,
                securityManager,
                countryManager,
                tournamentManager
            );

        }
Esempio n. 3
0
        public void Init()
        {
            // Create user for finance and tournament management

            DebRegDataMocks dataMocks = new DebRegDataMocks();
            DebRegUserManager userManager = dataMocks.UserManager;
            {
                var task = userManager.CreateAsync(financeManagerUser);
                if (!task.IsCompleted)
                {
                    task.Wait();
                }
            }

            // Create hosting organization

            SecurityMocks securityMocks = new SecurityMocks();
            IAuthenticationManager authManager = securityMocks.AuthManager;
            ISecurityManager securityManager = new SecurityManager(userManager, authManager);

            IUnitOfWork unitOfWork = dataMocks.UnitOfWork;
            IOrganizationManager organizationManager = new OrganizationManager(unitOfWork, userManager);
            {
                var task = organizationManager.CreateOrganizationAsync(hostingOrganization, financeManagerUser);
                if (!task.IsCompleted)
                {
                    task.Wait();
                }
            }

            // Make user tournament manager

            OrganizationUser organizationUser = new OrganizationUser
            {
                Organization = hostingOrganization,
                OrganizationId = hostingOrganization.Id,
                User = financeManagerUser,
                UserId = financeManagerUser.Id,
                Role = OrganizationRole.OrganizationTournamentManager
            };
            financeManagerUser.OrganizationAssociations.Add(organizationUser);
            hostingOrganization.UserAssociations.Add(organizationUser);
            financeManagerUser.OrganizationAssociations.Add(organizationUser);
            unitOfWork.GetRepository<OrganizationUser>().Insert(organizationUser);
            unitOfWork.Save();

            // Create tournament

            ITournamentManager tournamentManager = new TournamentManager(unitOfWork, userManager);

            tournament = new Tournament
            {
                Id = Guid.NewGuid(),
                HostingOrganization = hostingOrganization,
                HostingOrganizationID = hostingOrganization.Id
            };
            {
                var task = tournamentManager.AddTournamentAsync(tournament, financeManagerUser);
                if (!task.IsCompleted)
                {
                    task.Wait();
                }
            }

            // Create Controller

            DebRegCommunicationMocks communicationMocks = new DebRegCommunicationMocks();
            IEMailService mailService = communicationMocks.EMailService;

            registrationManager = new TournamentRegistrationsManager(unitOfWork, mailService, userManager);
            IBookingManager bookingManager = new BookingManager(unitOfWork);
            IPaymentManager paymentManager = new PaymentManager(registrationManager, bookingManager, mailService);

            financeController = new FinanceController(tournamentManager, registrationManager, paymentManager, bookingManager, userManager);

            // Set controller context
            httpMocks.UserId = financeManagerUser.Id;
            httpMocks.UserName = financeManagerUser.UserName;

            financeController.ControllerContext = httpMocks.ControllerContext;
        }