Пример #1
0
        private void ConfigureMailService(SMTPHostConfiguration smtpHostConfiguration) {
            mailService.Host = smtpHostConfiguration.Host;
            mailService.Port = smtpHostConfiguration.Port;
            mailService.SSL = smtpHostConfiguration.SSL;

            mailService.Username = smtpHostConfiguration.Username;
            mailService.Password = smtpHostConfiguration.Password;

            mailService.FromAddress = smtpHostConfiguration.FromAddress;

            mailService.SendCompleted += mailService_SendCompleted;
        }
Пример #2
0
        public void CreateOrganizationAsync_WithValidOrganization_ShouldCreateOrganization() {
            #region Arrange
            // Arrange

            User user = new User { Id = Guid.NewGuid().ToString() };

            String abbreviation = " Org ";
            String city = " City ";
            String country = " Country ";
            String postalCode = " PostalCode ";
            String region = " Region ";
            String streetAddress1 = " Street Address 1 ";
            String streetAddress2 = " Street Address 2 ";
            List<Organization> linkedOrganizations = new List<Organization>();
            linkedOrganizations.Add(new Organization());
            List<OrganizationUser> userAssociations = new List<OrganizationUser>();
            userAssociations.Add(new OrganizationUser());
            List<TournamentOrganizationRegistration> tournamentRegistrations = new List<TournamentOrganizationRegistration>();
            tournamentRegistrations.Add(new TournamentOrganizationRegistration());
            String name = " Organization Name ";
            Boolean university = false;
            String vatId = " ATU12345678 ";
            SMTPHostConfiguration smtpHostConfiguration = new SMTPHostConfiguration();

            Organization organization = new Organization {
                Abbreviation = abbreviation,
                Address = new Address {
                    City = city,
                    Country = country,
                    PostalCode = postalCode,
                    Region = region,
                    StreetAddress1 = streetAddress1,
                    StreetAddress2 = streetAddress2,
                },
                LinkedOrganizations = linkedOrganizations,
                UserAssociations = userAssociations,
                TournamentRegistrations = tournamentRegistrations,
                Name = name,
                SMTPHostConfiguration = smtpHostConfiguration,
                Status = OrganizationStatus.Approved,
                University = university,
                VatId = vatId
            };
            #endregion

            // Act

            var task = organizationManager.CreateOrganizationAsync(organization, user);

            if (!task.IsCompleted) { task.Wait(); }

            var result = task.Result;

            #region Assert
            // Assert

            Assert.AreEqual(CreateOrUpdateOrganizationResult.Success, result);

            var savedOrganization = organizationManager.GetOrganization(organization.Id);

            Assert.AreEqual(abbreviation.Trim(), savedOrganization.Abbreviation);

            Assert.AreNotEqual(Guid.Empty, savedOrganization.Address.Id);
            Assert.AreEqual(city.Trim(), savedOrganization.Address.City);
            Assert.AreEqual(country.Trim(), savedOrganization.Address.Country);
            Assert.AreEqual(postalCode.Trim(), savedOrganization.Address.PostalCode);
            Assert.AreEqual(region.Trim(), savedOrganization.Address.Region);
            Assert.AreEqual(streetAddress1.Trim(), savedOrganization.Address.StreetAddress1);
            Assert.AreEqual(streetAddress2.Trim(), savedOrganization.Address.StreetAddress2);

            Assert.AreEqual(0, savedOrganization.UserAssociations.Count);

            var organizationUser = unitOfWork.GetRepository<OrganizationUser>().GetById(organization.Id, user.Id, OrganizationRole.Delegate);
            Assert.IsNotNull(organizationUser);

            Assert.AreEqual(0, savedOrganization.TournamentRegistrations.Count);

            Assert.AreEqual(name.Trim(), savedOrganization.Name);
            Assert.AreNotEqual(Guid.Empty, savedOrganization.SMTPHostConfiguration.Id);
            Assert.AreEqual(OrganizationStatus.Unknown, savedOrganization.Status);
            Assert.AreEqual(university, savedOrganization.University);
            Assert.AreEqual(vatId.Trim(), savedOrganization.VatId);

            Assert.IsNotNull(savedOrganization.ModifiedBy);
            Assert.IsNotNull(savedOrganization.Modified);
            Assert.IsNotNull(savedOrganization.CreatedBy);
            Assert.IsNotNull(savedOrganization.Created);
            #endregion
        }
Пример #3
0
        private Organization CreateOrganizationObject()
        {
            String abbreviation = " Org ";
            String city = " City ";
            String country = " Country ";
            String postalCode = " PostalCode ";
            String region = " Region ";
            String streetAddress1 = " Street Address 1 ";
            String streetAddress2 = " Street Address 2 ";
            String name = " Organization Name ";
            Boolean university = false;
            String vatId = " ATU12345678 ";
            SMTPHostConfiguration smtpHostConfiguration = new SMTPHostConfiguration();

            Organization organization = new Organization
            {
                Abbreviation = abbreviation,
                Address = new Address
                {
                    City = city,
                    Country = country,
                    PostalCode = postalCode,
                    Region = region,
                    StreetAddress1 = streetAddress1,
                    StreetAddress2 = streetAddress2,
                },
                Name = name,
                SMTPHostConfiguration = smtpHostConfiguration,
                Status = OrganizationStatus.Approved,
                University = university,
                VatId = vatId
            };

            return organization;
        }