Example #1
0
        public void UpdateTournament_WithValidUser_ShouldUpdateTournament()
        {
            // Arrange
            #region ARRANGE

            #region CREATE ORIGINAL TOURNAMENT

            var tournament = CreateTournament();

            unitOfWork.GetRepository<Tournament>().Insert(tournament);
            unitOfWork.Save();
            #endregion

            #region CREATE UPDATED TOURNAMENT

            string tournamentName = "test tournament";
            string tournamentLocation = "test location";
            DateTime tournamentStart = DateTime.Today.AddDays(30);
            DateTime tournamentEnd = tournamentStart.AddDays(2);
            DateTime tournamentRegistrationStart = tournamentStart.AddDays(-30);
            DateTime tournamentRegistrationEnd = tournamentRegistrationStart.AddDays(7);
            int? tournamentAdjudicatorSubtract = 2;
            int tournamentTeamSize = 2;
            int tournamentTeamCap = 48;
            int tournamentAdjudicatorCap = 48;
            Product teamProduct = new Product
            {
                Id = Guid.NewGuid()
            };
            Product adjudicatorProduct = new Product
            {
                Id = Guid.NewGuid()
            };
            bool tournamentUniversityRequired = false;
            Currency tournamentCurrency = new Currency
            {
                Id = Guid.NewGuid()
            };
            string tournamentFinanceEmail = "*****@*****.**";
            string tournamentTC = "Terms & Conditions";
            string tournamentTCLink = "http://tournamnet.org/tc.html";
            string tournamentMoneyTransferLinkCaption = "Money transfer";
            string tournamentMondeyTransferLink = "http://moneytransfer.com";
            string tournamentPaymentReference = "Payment reference";
            BankAccount bankAccount = new BankAccount
            {
                Id = Guid.NewGuid()
            };

            tournament = new Tournament
            {
                Id = tournament.Id,
                HostingOrganization = organization,
                Name = tournamentName,
                Location = tournamentLocation,
                Start = tournamentStart,
                End = tournamentEnd,
                RegistrationStart = tournamentRegistrationStart,
                RegistrationEnd = tournamentRegistrationEnd,
                AdjucatorSubtract = tournamentAdjudicatorSubtract,
                TeamSize = tournamentTeamSize,
                TeamCap = tournamentTeamCap,
                AdjudicatorCap = tournamentAdjudicatorCap,
                TeamProduct = teamProduct,
                AdjudicatorProduct = adjudicatorProduct,
                UniversityRequired = tournamentUniversityRequired,
                Currency = tournamentCurrency,
                FinanceEMail = tournamentFinanceEmail,
                TermsConditions = tournamentTC,
                TermsConditionsLink = tournamentTCLink,
                MoneyTransferLinkCaption = tournamentMoneyTransferLinkCaption,
                MoneyTransferLink = tournamentMondeyTransferLink,
                PaymentReference = tournamentPaymentReference,
                BankAccount = bankAccount
            };
            #endregion

            var user = CreateUserWithOrganizationRole(organization, OrganizationRole.OrganizationTournamentManager);

            #endregion

            // Act

            tournamentManager.UpdateTournament(tournament, user);

            // Assert

            #region ASSERT

            var savedTournament = unitOfWork.GetRepository<Tournament>().GetById(tournament.Id);
            //Assert.AreNotEqual(tournament, savedTournament);
            Assert.AreEqual(tournament.Id, savedTournament.Id);
            Assert.AreEqual(tournament.HostingOrganization, savedTournament.HostingOrganization);
            Assert.AreEqual(tournament.Name, savedTournament.Name);
            Assert.AreEqual(tournament.Location, savedTournament.Location);
            Assert.AreEqual(tournament.Start, savedTournament.Start);
            Assert.AreEqual(tournament.End, savedTournament.End);
            Assert.AreEqual(tournament.RegistrationStart, savedTournament.RegistrationStart);
            Assert.AreEqual(tournament.RegistrationEnd, savedTournament.RegistrationEnd);
            Assert.AreEqual(tournament.AdjucatorSubtract, savedTournament.AdjucatorSubtract);
            Assert.AreEqual(tournament.TeamSize, savedTournament.TeamSize);
            Assert.AreEqual(tournament.TeamCap, savedTournament.TeamCap);
            Assert.AreEqual(tournament.AdjudicatorCap, savedTournament.AdjudicatorCap);
            Assert.AreEqual(tournament.TeamProduct, savedTournament.TeamProduct);
            Assert.AreEqual(tournament.AdjudicatorProduct, savedTournament.AdjudicatorProduct);
            Assert.AreEqual(tournament.UniversityRequired, savedTournament.UniversityRequired);
            Assert.AreEqual(tournament.Currency, savedTournament.Currency);
            Assert.AreEqual(tournament.FinanceEMail, savedTournament.FinanceEMail);
            Assert.AreEqual(tournament.TermsConditions, savedTournament.TermsConditions);
            Assert.AreEqual(tournament.TermsConditionsLink, savedTournament.TermsConditionsLink);
            Assert.AreEqual(tournament.MoneyTransferLinkCaption, savedTournament.MoneyTransferLinkCaption);
            Assert.AreEqual(tournament.MoneyTransferLink, savedTournament.MoneyTransferLink);
            Assert.AreEqual(tournament.PaymentReference, savedTournament.PaymentReference);
            Assert.AreEqual(tournament.BankAccount, savedTournament.BankAccount);

            Assert.AreEqual(savedTournament.ModifiedBy, user);
            Assert.IsNotNull(savedTournament.Modified);

            #endregion
        }
Example #2
0
 public void UpdateBankAccount(BankAccount account, User user)
 {
     throw new NotImplementedException();
 }