public void TranslateLocationChannelStep3(int visitingAddressCount, int mailAddressCount, bool mailAddressSelected) { var model = CreateModel().Step1Form; model.VisitingAddresses = itemListGenerator.Create <VmAddressSimple>(visitingAddressCount); model.PostalAddresses = itemListGenerator.Create <VmAddressSimple>(mailAddressCount); var toTranslate = new List <VmLocationChannelStep1>() { model }; var translations = RunTranslationModelToEntityTest <VmLocationChannelStep1, ServiceLocationChannel>(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); }
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 TranslateServiceChannelServiceHourToEntity(ServiceHoursTypeEnum serviceHoursType, int dailyCount, int extraCount, bool nonstop) { var model = TestHelper.CreateVmHoursModel<VmNormalHours>(serviceHoursType); model.ServiceHoursType = serviceHoursType; model.DailyHours = listModelGenerator.Create(dailyCount, i => new VmDailyHours { Extra = i < extraCount ? DailyHoursExtraTypes.Vissible : DailyHoursExtraTypes.Hidden }); model.DailyHours.Count.Should().Be(dailyCount); model.DailyHours.Count(x => x.Extra == DailyHoursExtraTypes.Vissible).Should().Be(extraCount); model.Nonstop = nonstop; var toTranslate = new List<VmNormalHours> { model }; var translations = RunTranslationModelToEntityTest<VmNormalHours, ServiceHours>(translators, toTranslate, unitOfWorkMock); var translation = translations.First(); Assert.Equal(toTranslate.Count, translations.Count); CheckTranslation(model, translation, dailyCount, extraCount); }
public void TranslateOpeningHours(int standardHoursCount, int exceptionHoursCount, int specialHoursCount) { var model = CreateModel(); model.StandardHours = itemListGenerator.Create <VmNormalHours>(standardHoursCount); model.ExceptionHours = itemListGenerator.Create <VmExceptionalHours>(exceptionHoursCount); model.SpecialHours = itemListGenerator.Create <VmSpecialHours>(exceptionHoursCount); var toTranslate = new List <VmOpeningHoursStep>() { model }; var translations = RunTranslationModelToEntityTest <VmOpeningHoursStep, ServiceChannelVersioned>(translators, toTranslate, unitOfWorkMock); var translation = translations.First(); Assert.Equal(toTranslate.Count, translations.Count); CheckTranslation(model, translation); }
public void TranslateServiceStep2ToEntityTest(int lifeEventsTree, int ontologyTermsTree, int serviceClassesTree, int targetGroups, int keewords) { var model = CreateModel(); model.Step2Form = new VmServiceStep2 { TargetGroups = itemListGenerator.Create <Guid>(targetGroups), LifeEvents = itemListGenerator.Create <VmListItem>(lifeEventsTree), OntologyTerms = itemListGenerator.Create <VmListItem>(ontologyTermsTree), ServiceClasses = itemListGenerator.Create <VmListItem>(serviceClassesTree), KeyWords = itemListGenerator.Create <Guid>(keewords) }; var toTranslate = new List <VmService>() { model }; 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.Step2Form, translation); }
public void TranslateServiceHoursToVm(ServiceHoursTypeEnum hoursType, bool setDateFrom, bool setDateTo, string additionalInfo) { var model = CreateModel(hoursType); model.AdditionalInformations = listModelGenerator.Create(additionalInfo == null ? 0 : 1, i => new ServiceHoursAdditionalInformation { Text = additionalInfo }); model.OpeningHoursTo = setDateFrom ? DateTime.Now : (DateTime?)null; model.OpeningHoursFrom = setDateTo ? DateTime.Now.AddDays(2) : (DateTime?)null; var toTranslate = new List <ServiceHours> { model }; var translations = RunTranslationEntityToModelTest <ServiceHours, VmHours>(translators, toTranslate); var translation = translations.First(); Assert.Equal(toTranslate.Count, translations.Count); CheckTranslation(model, translation); }
public void TranslateServiceHoursToVm(ServiceHoursTypeEnum hoursType, bool isClosed) { var model = CreateModel(hoursType); model.IsClosed = isClosed; model.DailyOpeningTimes = listModelGenerator.Create(1, i => new DailyOpeningTime { From = new TimeSpan(0, 8, 0) }); model.OpeningHoursFrom = DateTime.Now; var toTranslate = new List <ServiceHours> { model }; var translations = RunTranslationEntityToModelTest <ServiceHours, VmExceptionalHours>(translators, toTranslate); var translation = translations.First(); Assert.Equal(toTranslate.Count, translations.Count); CheckTranslation(model, translation); }