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;
        }
Beispiel #2
0
        public void Init()
        {
            // Create mocks
            DebRegDataMocks dataMocks = new DebRegDataMocks();
            DebRegCommunicationMocks communicationMocks = new DebRegCommunicationMocks();
            userManager = dataMocks.UserManager;

            unitOfWork = dataMocks.UnitOfWork;
            // Create Managers
            slotAssignmentManager = new SlotAssignmentManager(unitOfWork);
            tournamentManager = new TournamentManager(unitOfWork, userManager);
            tournamentRegistrationsManager = new TournamentRegistrationsManager(unitOfWork, communicationMocks.EMailService, userManager);
            bookingManager = new BookingManager(unitOfWork);

            slotManager = new SlotManager(slotAssignmentManager, tournamentRegistrationsManager, tournamentManager, bookingManager, communicationMocks.EMailService, userManager);

            // Create basic objects

            Organization hostingOrganization = new Organization { Id = Guid.NewGuid() };
            Random rand = new Random();

            User user = CreateUserWithOrganizationRole(hostingOrganization, OrganizationRole.OrganizationTournamentManager);

            // Create tournament

            tournament = new Tournament
            {
                Id = Guid.NewGuid(),
                HostingOrganization = hostingOrganization,
                HostingOrganizationID = hostingOrganization.Id,
                TeamProduct = new Product
                {
                    Id = Guid.NewGuid(),
                    Price = 40
                },
                AdjudicatorProduct = new Product
                {
                    Id = Guid.NewGuid(),
                    Price = 20
                }
            };
            {
                var task = tournamentManager.AddTournamentAsync(tournament, user);
                if (!task.IsCompleted)
                {
                    task.Wait();
                }
            }

            // Create registrations
            Guid[] organizationIds = new Guid[] { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };

            for (int i = 0; i < organizationIds.Length; i++)
            {
                int teamsWanted = i + 1;
                int adjudicatorsWanted = i;
                var registration = tournamentRegistrationsManager.AddRegistration(
                    tournament.Id,
                    organizationIds[i],
                    organizationIds[i],
                    teamsWanted,
                    adjudicatorsWanted,
                    null,
                    user
                );

                registration.OrganizationStatus = OrganizationStatus.Approved;
                registration.OrganizationStatusDraft = false;
            }

        }
        //public TournamentRegistrationController(IUnitOfWork unitOfWork, ITournamentRegistrationsManager tournamentRegistrationsManager, IBookingManager bookingManager, ISlotManager slotManager, ISecurityManager securityManager)
        //{
        //    this.unitOfWork = unitOfWork;
        //    this.tournamentRegistrationsManager = tournamentRegistrationsManager;
        //    this.bookingManager = bookingManager;
        //    userManager = UserManager;
        //    this.slotManager = slotManager;
        //    this.securityManager = securityManager;
        //}

        public TournamentRegistrationController(IUnitOfWork unitOfWork, ITournamentRegistrationsManager tournamentRegistrationsManager, IBookingManager bookingManager, DebRegUserManager userManager, ISlotManager slotManager, ISecurityManager securityManager)
        {
            this.unitOfWork = unitOfWork;
            this.tournamentRegistrationsManager = tournamentRegistrationsManager;
            this.bookingManager = bookingManager;
            this.slotManager = slotManager;
            this.securityManager = securityManager;

            this.userManager = userManager;
        }
Beispiel #4
0
 public PaymentManager(ITournamentRegistrationsManager registrationsManager, IBookingManager bookingManager, IEMailService mailService) {
     this.registrationsManager = registrationsManager;
     this.bookingManager = bookingManager;
     this.mailService = mailService;
 }
Beispiel #5
0
 public SlotManager(ISlotAssignmentManager slotAssignmentManager, ITournamentRegistrationsManager tournamentRegistrationsManager, ITournamentManager tournamentManager, IBookingManager bookingManager, IEMailService mailService, DebRegUserManager userManager)
 {
     this.slotAssignmentManager = slotAssignmentManager;
     this.tournamentregistrationsManager = tournamentRegistrationsManager;
     this.tournamentManager = tournamentManager;
     this.bookingManager = bookingManager;
     this.mailService = mailService;
     this.userManager = userManager;
 }
        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;
        }
Beispiel #7
0
 public AdjudicatorController(DebRegUserManager userManager, ITournamentRegistrationsManager tournamentRegistrationsManager)
 {
     this.userManager = userManager;
     this.tournamentRegistrationsManager = tournamentRegistrationsManager;
 }
Beispiel #8
0
        //public FinanceController(ITournamentManager tournamentManager, ITournamentRegistrationsManager registrationManager, IPaymentManager paymentManager, IBookingManager bookingManager)
        //{
        //    this.tournamentManager = tournamentManager;
        //    this.registrationManager = registrationManager;
        //    this.paymentManager = paymentManager;
        //    // this.claimsManager = claimsManager;
        //    this.bookingManager = bookingManager;
        //    this.userManager = UserManager;
        //}

        public FinanceController(ITournamentManager tournamentManager, ITournamentRegistrationsManager registrationManager, IPaymentManager paymentManager, IBookingManager bookingManager, DebRegUserManager userManager)
        {
            this.tournamentManager = tournamentManager;
            this.registrationManager = registrationManager;
            this.paymentManager = paymentManager;
            this.bookingManager = bookingManager;

            this.userManager = userManager;
        }
Beispiel #9
0
        //public ActionResult SendAssignmentNotifications() {
        //    // Find currentTournament

        //    var ident = HttpContext.User.Identity as ClaimsIdentity;
        //    var currentTournamentId = claimsManager.GetCurrentTournamentId(ident);
        //    var user = userManager.FindById(ident.GetUserId());

        //    String paymentPageUrl = HttpContext.Request.Url.GetLeftPart(UriPartial.Authority) +
        //        Url.Action("Display", "TournamentRegistration", new {
        //            Area = "",
        //            tournamentId = "{0}",   // will be filled by slotManager
        //            organizationId = "{1}",  // will be filled by slotManager
        //            tab = "account",
        //        });
        //    paymentPageUrl = HttpContext.Server.UrlDecode(paymentPageUrl);
        //    slotManager.SendAssignmentNotifications(currentTournamentId, paymentPageUrl, user);
        //    return Redirect("Index");
        //}
        public SlotController(
            IUnitOfWork unitOfWork,
            ITournamentRegistrationsManager tournamentRegistrationsManager,
            ISlotAssignmentManager slotAssignmentManager,
            ISlotManager slotManager,
            IOrganizationManager organizationManager,
            ITournamentManager tournamentManager,
            DebRegUserManager userManager)
        {
            this.unitOfWork = unitOfWork;
            // this.claimsManager = claimsManager;
            this.tournamentRegistrationsManager = tournamentRegistrationsManager;
            this.slotAssignmentManager = slotAssignmentManager;
            this.slotManager = slotManager;
            this.organizationManager = organizationManager;
            this.tournamentManager = tournamentManager;
            this.userManager = userManager;
        }
Beispiel #10
0
 public TournamentsController(ITournamentManager tournamentManager, ITournamentRegistrationsManager tournamentRegistrationsManager, DebRegUserManager userManager)
 {
     this.tournamentManager = tournamentManager;
     this.userManager = userManager;
     this.tournamentRegistrationsManager = tournamentRegistrationsManager;
 }
Beispiel #11
0
 public ReportController(ITournamentRegistrationsManager tournamentRegistrationsManager, ITournamentManager tournamentManager, ICountryManager countryManager, DebRegUserManager userManager, ISecurityManager securityManager, ISlotManager slotManager)
 {
     this.tournamentRegistrationsManager = tournamentRegistrationsManager;
     this.tournamentManager = tournamentManager;
     this.countryManager = countryManager;
     this.securityManager = securityManager;
     this.userManager = userManager;
     this.slotManager = slotManager;
 }