Ejemplo n.º 1
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
            );

        }
Ejemplo n.º 2
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);
        }
        public void Init()
        {
            var securityMocks = new SecurityMocks();
            httpMocks = new HTTPMocks();


            var debRegDataMocks = new DebRegDataMocks();
            unitOfWork = debRegDataMocks.UnitOfWork;
            userManager = debRegDataMocks.UserManager;


            var communicationMocks = new DebRegCommunicationMocks();

            tournamentRegistrationsManager = new TournamentRegistrationsManager(unitOfWork, communicationMocks.EMailService, userManager);
            bookingManager = new BookingManager(unitOfWork);

            ISlotManager slotManager = null;
            ISecurityManager securityManager = null;

            tournamentRegistrationController = new TournamentRegistrationController(
                unitOfWork,
                tournamentRegistrationsManager,
                bookingManager,
                userManager,
                slotManager,
                securityManager
            );
            tournamentRegistrationController.ControllerContext = httpMocks.ControllerContext;
        }
Ejemplo n.º 4
0
        public void Init()
        {
            var debRegDataMocks = new DebRegDataMocks();
            unitOfWork = debRegDataMocks.UnitOfWork;
            userManager = debRegDataMocks.UserManager;
            organizationManager = new OrganizationManager(unitOfWork, userManager);

            var securityMocks = new SecurityMocks();
            var securityManager = securityMocks.SecurityManager;
            organizationManager = new OrganizationManager(unitOfWork, userManager);


            organizationController = new OrganizationController(organizationManager, unitOfWork, securityManager, userManager);

            httpMocks = new HTTPMocks();
            organizationController.ControllerContext = httpMocks.ControllerContext;

        }
Ejemplo n.º 5
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;
        }