예제 #1
0
        public async Task <ProducerContact> GetProducerContact(contactDetailsType contactDetails)
        {
            var countryName = GetCountryName(contactDetails.address.country);
            var country     = await dataAccess.GetCountry(countryName);

            ProducerAddress address = new ProducerAddress(
                contactDetails.address.primaryName,
                contactDetails.address.secondaryName,
                contactDetails.address.streetName,
                contactDetails.address.town,
                contactDetails.address.locality,
                contactDetails.address.administrativeArea,
                country,
                contactDetails.address.Item);

            ProducerContact contact = new ProducerContact(
                contactDetails.title,
                contactDetails.forename,
                contactDetails.surname,
                contactDetails.phoneLandLine,
                contactDetails.phoneMobile,
                contactDetails.fax,
                contactDetails.email,
                address);

            return(contact);
        }
예제 #2
0
            public static ProducerContact WithProducerAddress(ProducerAddress address)
            {
                var builder = new ProducerContactBuilder();

                builder.address = address;

                return(builder.Build());
            }
        private ProducerBusiness CreatePartnershipBusiness()
        {
            var producerAddress = new ProducerAddress("PrimaryName", "SecondaryName", "Street", "Town", "Locality", "AdministrativeArea",
                                                      new Country(A.Dummy <Guid>(), "TestCountry"), "PostCode");

            var producerContact = new ProducerContact(
                "Title", "Forename", "Surname", "123456", "1235467", "12345678", "[email protected]", producerAddress);

            return(new ProducerBusiness(partnership: new Partnership("TestPartnership", producerContact, new List <Partner> {
            })));
        }
예제 #4
0
        public void Producer_SetProducerPartnershipCountry_Returns_RegOfficeOrPPoBCountry()
        {
            // Arrange
            Scheme scheme = new Scheme(
                A.Dummy <Guid>());

            MemberUpload memberUpload = new MemberUpload(
                A.Dummy <Guid>(),
                A.Dummy <string>(),
                A.Dummy <List <MemberUploadError> >(),
                A.Dummy <decimal>(),
                2019,
                scheme,
                A.Dummy <string>(),
                A.Dummy <string>());

            RegisteredProducer registeredProducer = new RegisteredProducer(
                "WEE/AA1111AA",
                2019,
                scheme);

            var producerAddress = new ProducerAddress("PrimaryName", "SecondaryName", "Street", "Town", "Locality", "AdministrativeArea",
                                                      new Country(A.Dummy <Guid>(), "SPAIN"), "PostCode");

            var producerContact = new ProducerContact(
                "Title", "Forename", "Surname", "123456", "1235467", "12345678", "[email protected]", producerAddress);

            var producerBusiness = new ProducerBusiness(
                partnership: new Partnership("TestPartnership", producerContact, new List <Partner> {
            }));

            var producer = new ProducerSubmission(
                registeredProducer,
                memberUpload,
                producerBusiness,
                null,
                new DateTime(2019, 3, 18),
                0,
                false,
                null,
                "Trading Name 1",
                EEEPlacedOnMarketBandType.Lessthan5TEEEplacedonmarket,
                SellingTechniqueType.Both,
                Domain.Obligation.ObligationType.Both,
                AnnualTurnOverBandType.Greaterthanonemillionpounds,
                new List <Domain.Producer.BrandName>(),
                new List <Domain.Producer.SICCode>(),
                A.Dummy <ChargeBandAmount>(),
                0,
                A.Dummy <StatusType>());

            Assert.Equal("SPAIN", producer.RegOfficeOrPBoBCountry);
        }
            public static ProducerContact WithProducerAddress(ProducerAddress address)
            {
                var builder = new ProducerContactBuilder();
                builder.address = address;

                return builder.Build();
            }
 public override bool Equals(ProducerAddress other)
 {
     return false;
 }
        public async Task HandleAsync_ForPartnershipProducer_ReturnsPartnershipContactDetails_AndIsCompanyValueFalse()
        {
            // Arrange
            Scheme scheme = new Scheme(A.Dummy <Guid>());

            MemberUpload memberUpload = new MemberUpload(
                A.Dummy <Guid>(),
                A.Dummy <string>(),
                A.Dummy <List <MemberUploadError> >(),
                A.Dummy <decimal>(),
                2017,
                scheme,
                A.Dummy <string>(),
                A.Dummy <string>());

            RegisteredProducer registeredProducer = new RegisteredProducer(
                "WEE/AA1111AA",
                2017,
                scheme);

            var producerAddress = new ProducerAddress("PrimaryName", "SecondaryName", "Street", "Town", "Locality", "AdministrativeArea",
                                                      new Country(A.Dummy <Guid>(), "TestCountry"), "PostCode");

            var producerContact = new ProducerContact(
                "Title", "Forename", "Surname", "123456", "1235467", "12345678", "[email protected]", producerAddress);

            var producerBusiness = new ProducerBusiness(
                partnership: new Partnership("TestPartnership", producerContact, new List <Partner> {
            }));

            var producer = new ProducerSubmission(
                registeredProducer,
                memberUpload,
                producerBusiness,
                null,
                new DateTime(2015, 1, 1),
                0,
                false,
                null,
                "Trading Name 1",
                EEEPlacedOnMarketBandType.Lessthan5TEEEplacedonmarket,
                SellingTechniqueType.Both,
                Domain.Obligation.ObligationType.Both,
                AnnualTurnOverBandType.Greaterthanonemillionpounds,
                new List <BrandName>(),
                new List <SICCode>(),
                A.Dummy <ChargeBandAmount>(),
                0,
                A.Dummy <StatusType>());

            IGetProducerDetailsDataAccess dataAccess = A.Fake <IGetProducerDetailsDataAccess>();

            A.CallTo(() => dataAccess.Fetch(A <string> ._, A <int> ._))
            .Returns(new List <ProducerSubmission> {
                producer
            });

            IWeeeAuthorization authorization = A.Fake <IWeeeAuthorization>();

            A.CallTo(() => authorization.CheckUserInRole(Roles.InternalAdmin))
            .Returns(false);

            IMapper mapper = A.Fake <IMapper>();

            GetProducerDetailsHandler handler = new GetProducerDetailsHandler(dataAccess, authorization, mapper);

            // Act
            var result = await handler.HandleAsync(A.Dummy <GetProducerDetails>());

            // Assert
            Assert.NotNull(result);
            Assert.Single(result.Schemes);

            ProducerContactDetails businessContact = result.Schemes[0].ProducerBusinessContact;

            Assert.Equal("PrimaryName, SecondaryName, Street, Town, Locality, AdministrativeArea, PostCode, TestCountry", businessContact.Address);
            Assert.Equal("Title Forename Surname", businessContact.ContactName);
            Assert.Equal("123456", businessContact.Telephone);
            Assert.Equal("1235467", businessContact.Mobile);
            Assert.Equal("[email protected]", businessContact.Email);
            Assert.False(result.Schemes[0].IsCompany);
        }
        public async Task<ProducerContact> GetProducerContact(contactDetailsType contactDetails)
        {
            var countryName = GetCountryName(contactDetails.address.country);
            var country = await dataAccess.GetCountry(countryName);

            ProducerAddress address = new ProducerAddress(
                contactDetails.address.primaryName,
                contactDetails.address.secondaryName,
                contactDetails.address.streetName,
                contactDetails.address.town,
                contactDetails.address.locality,
                contactDetails.address.administrativeArea,
                country,
                contactDetails.address.Item);

            ProducerContact contact = new ProducerContact(
                contactDetails.title,
                contactDetails.forename,
                contactDetails.surname,
                contactDetails.phoneLandLine,
                contactDetails.phoneMobile,
                contactDetails.fax,
                contactDetails.email,
                address);

            return contact;
        }
예제 #9
0
 public override bool Equals(ProducerAddress other)
 {
     return(false);
 }