Example #1
0
        public void WhenCreatingStandardOrganisationDocument()
        {
            const string epaOrganisationIdentifier = "OrgIdentifier";
            const string organisationType          = "Awarding Organisation";
            const string email           = "*****@*****.**";
            const string phone           = "555-5555";
            const string epaOrganisation = "EpaOrg";
            const string websiteLink     = "http://testemail.com";
            const string standardCode    = "standard_code";
            var          effectiveFrom   = DateTime.Today.AddDays(-7);
            var          effectiveTo     = DateTime.Today.AddDays(7);

            var address = new Indexer.Core.AssessmentOrgs.Models.Address
            {
                Primary   = "primary address",
                Secondary = "secondary address",
                Street    = "address street",
                Town      = "address town",
                Postcode  = "PO1 1OP"
            };

            var standardOrganisationsData = new StandardOrganisationsData
            {
                EpaOrganisationIdentifier = epaOrganisationIdentifier,
                OrganisationType          = organisationType,
                Email           = email,
                Phone           = phone,
                Address         = address,
                EpaOrganisation = epaOrganisation,
                WebsiteLink     = websiteLink,
                StandardCode    = standardCode,
                EffectiveFrom   = effectiveFrom,
                EffectiveTo     = effectiveTo
            };

            var mapper = new ElasticsearchMapper(_settings.Object, _organisationTypeProcessor.Object);

            var standardOrganisationDocument = mapper.CreateStandardOrganisationDocument(standardOrganisationsData);

            standardOrganisationDocument.EpaOrganisationIdentifier.Should().Be(epaOrganisationIdentifier);
            standardOrganisationDocument.OrganisationType.Should().Be(organisationType);
            standardOrganisationDocument.Email.Should().Be(email);
            standardOrganisationDocument.Phone.Should().Be(phone);
            standardOrganisationDocument.EpaOrganisation.Should().Be(epaOrganisation);
            standardOrganisationDocument.WebsiteLink.Should().Be(websiteLink);
            standardOrganisationDocument.Address.Primary.Should().Be(address.Primary);
            standardOrganisationDocument.Address.Secondary.Should().Be(address.Secondary);
            standardOrganisationDocument.Address.Street.Should().Be(address.Street);
            standardOrganisationDocument.Address.Town.Should().Be(address.Town);
            standardOrganisationDocument.Address.Postcode.Should().Be(address.Postcode);
            standardOrganisationDocument.StandardCode.Should().Be(standardCode);
            standardOrganisationDocument.EffectiveFrom.Should().Be(effectiveFrom);
            standardOrganisationDocument.EffectiveTo.Should().Be(effectiveTo);
        }
Example #2
0
        public void WhenCreatingOrganisationDocument()
        {
            const string epaOrganisationIdentifier = "OrgIdentifier";
            const string organisationType          = "Awarding Organisation";
            const string email           = "*****@*****.**";
            const string phone           = "555-5555";
            const string epaOrganisation = "EpaOrg";
            const string websiteLink     = "http://testemail.com";
            var          address         = new Indexer.Core.AssessmentOrgs.Models.Address
            {
                Primary   = "primary address",
                Secondary = "secondary address",
                Street    = "address street",
                Town      = "address town",
                Postcode  = "PO1 1OP"
            };

            var organisation = new Organisation
            {
                EpaOrganisationIdentifier = epaOrganisationIdentifier,
                OrganisationType          = organisationType,
                Email           = email,
                Phone           = phone,
                Address         = address,
                EpaOrganisation = epaOrganisation,
                WebsiteLink     = websiteLink
            };

            var mapper = new ElasticsearchMapper(_settings.Object, _organisationTypeProcessor.Object);

            var organisationDocument = mapper.CreateOrganisationDocument(organisation);

            organisationDocument.EpaOrganisationIdentifier.Should().Be(epaOrganisationIdentifier);
            organisationDocument.OrganisationType.Should().Be(organisationType);
            organisationDocument.Email.Should().Be(email);
            organisationDocument.Phone.Should().Be(phone);
            organisationDocument.EpaOrganisation.Should().Be(epaOrganisation);
            organisationDocument.WebsiteLink.Should().Be(websiteLink);
            organisationDocument.Address.Primary.Should().Be(address.Primary);
            organisationDocument.Address.Secondary.Should().Be(address.Secondary);
            organisationDocument.Address.Street.Should().Be(address.Street);
            organisationDocument.Address.Town.Should().Be(address.Town);
            organisationDocument.Address.Postcode.Should().Be(address.Postcode);
        }