Example #1
0
        public void TranslateOrganizationStep1ToEntityTest(string name, string alternateName, string description, string parentOrganizationId, string municipalityId,
                                                           bool showContacts, bool ShowPostalAddress, bool ShowVisitingAddress,
                                                           int selectedEmails, int selectedPhoneNumbers, int selectedWebPages, int postalAddresess, int visitingAddresses)
        {
            var model = CreateModel();

            model.PublishingStatusId = PublishingStatus.Draft.ToString().GetGuid();

            model.Step1Form.OrganizationName          = name;
            model.Step1Form.OrganizationAlternateName = alternateName;
            model.Step1Form.Description = description;
            model.Step1Form.ParentId    = conversion.GetGuid(parentOrganizationId);
            Guid?municipalityGuid = conversion.GetGuid(municipalityId);

            model.Step1Form.Municipality = municipalityGuid.IsAssigned() ? new VmListItem {
                Id = municipalityGuid ?? Guid.Empty
            } : null;
            model.Step1Form.OrganizationTypeId = Guid.NewGuid();

            model.Step1Form.ShowContacts        = showContacts;
            model.Step1Form.ShowPostalAddress   = ShowPostalAddress;
            model.Step1Form.ShowVisitingAddress = ShowVisitingAddress;

            model.Step1Form.Emails            = itemListGenerator.Create <VmEmailData>(selectedEmails);
            model.Step1Form.PhoneNumbers      = itemListGenerator.Create <VmPhone>(selectedEmails);
            model.Step1Form.WebPages          = itemListGenerator.Create <VmWebPage>(selectedWebPages);
            model.Step1Form.VisitingAddresses = itemListGenerator.Create <VmAddressSimple>(visitingAddresses, c => new VmAddressSimple {
                PostalCode = new VmPostalCode(), StreetType = AddressTypeEnum.Street.ToString()
            });
            model.Step1Form.PostalAddresses = itemListGenerator.Create <VmAddressSimple>(postalAddresess, c => new VmAddressSimple {
                StreetType = AddressTypeEnum.Foreign.ToString()
            });

            var toTranslate = new List <VmOrganizationModel>()
            {
                model
            };

            var translations = RunTranslationModelToEntityTest <VmOrganizationModel, OrganizationVersioned>(translators, toTranslate, unitOfWorkMock);
            var translation  = translations.First();

            CheckTranslation(model, model.Step1Form, translation);
        }
        public void TranslateLocationChannelAddress(string type)
        {
            var model = CreateModel();

            model.TypeId = conversion.GetGuid(type);

            var toTranslate = new List <VmWebPage>()
            {
                model
            };

            var translations = RunTranslationModelToEntityTest <VmWebPage, ServiceChannelWebPage>(translators, toTranslate, unitOfWorkMock);
            var translation  = translations.First();

            Assert.Equal(toTranslate.Count, translations.Count);
            CheckTranslation(model, translation);
        }
        public void TranslateLocationChannelStep1(string organization, int selectedLanguages)
        {
            var model = CreateModel().Step1Form;

            model.OrganizationId = conversion.GetGuid(organization);
            model.Languages      = itemListGenerator.Create <VmListItem>(selectedLanguages).Select(x => x.Id).ToList();

            var toTranslate = new List <VmLocationChannelStep1>()
            {
                model
            };

            var translations = RunTranslationModelToEntityTest <VmLocationChannelStep1, ServiceChannelVersioned>(translators, toTranslate, unitOfWorkMock);
            var translation  = translations.First();

            Assert.Equal(toTranslate.Count, translations.Count);
            CheckTranslation(model, translation);
        }
Example #4
0
        public void TranslateServiceStep1ToEntityTest(string name, string name2, string desc1, string desc2, string desc3, string usage, string language, int municipalities, string serviceCoverageId, CoverageTypeEnum serviceCoverageType)
        {
            var model = CreateModel();

            model.Step1Form = new VmServiceStep1
            {
                ServiceName                         = name,
                AlternateServiceName                = name2,
                Description                         = desc1,
                ShortDescriptions                   = desc2,
                UserInstruction                     = desc3,
                AdditionalInformation               = "AdditionalInformation",
                AdditionalInformationDeadLine       = "AdditionalInformationDeadLine",
                AdditionalInformationProcessingTime = "AdditionalInformationProcessingTime",
                //AdditionalInformationTasks = "AdditionalInformationProcessingTime",
                AdditionalInformationValidityTime = "AdditionalInformationValidityTime",
                ServiceUsage = usage,
                Languages    = string.IsNullOrEmpty(language) ? new List <Guid>() : new List <Guid> {
                    Guid.Parse(language)
                },
                FundingTypeId = ServiceFundingTypeEnum.MarketFunded.ToString().GetGuid()
            };

            var toTranslate = new List <VmService>()
            {
                model
            };
            Guid?serviceCoverageTypeId = conversion.GetGuid(serviceCoverageId);
//            if (serviceCoverageTypeId != null) model.Step1Form.ServiceCoverageTypeId = serviceCoverageTypeId.Value;
//            model.Step1Form.Municipalities = itemListGenerator.Create<Guid>(municipalities);
            var translations = RunTranslationModelToEntityTest <VmService, ServiceVersioned>(translators, toTranslate, unitOfWorkMock);
            var translation  = translations.First();

            Assert.Equal(toTranslate.Count, translations.Count);
//            translation.PublishingStatus.Code.Should().Be(PublishingStatus.Draft.ToString());
//            translation.PublishingStatusId.Should().Be(model.PublishingStatus);
//            translation.PublishingStatusId.Should().Be(PublishingStatus.Draft.ToString().GetGuid());
            CheckTranslation(model, model.Step1Form, translation);
        }