public TestDataMapper(IVmOpenApiOrganizationVersionBase organization, DataSource source, IServiceProvider serviceProvider) : base(organization, source, serviceProvider) { generalDescriptionService = serviceProvider.GetService <IGeneralDescriptionService>(); serviceNameMapping = new Dictionary <int, string>(); serviceNameMapping.Add(25510, "Aineisto- ja tietopalvelu"); serviceNameMapping.Add(25512, "Aineisto- ja tietopalvelu"); serviceNameMapping.Add(25514, "Aineisto- ja tietopalvelu"); serviceNameMapping.Add(26444, "Perusopetus"); serviceNameMapping.Add(25302, "Kunnan vuokra-asunnot"); }
public DataMapper(IVmOpenApiOrganizationVersionBase organization, DataSource source, IServiceProvider serviceProvider) { if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } this.organization = organization; this.source = source; this.serviceProvider = serviceProvider; this.logger = this.serviceProvider.GetService <ILoggerFactory>().CreateLogger <DataMapper>(); }
private void CheckTranslations(OrganizationVersioned source, IVmOpenApiOrganizationVersionBase target) { target.OrganizationNames.Count.Should().Be(1); target.Municipality.Name.FirstOrDefault().Value.Should().Be(source.Municipality.MunicipalityNames.FirstOrDefault().Name); target.OrganizationDescriptions.First().Value.Should().NotBeNull(); target.OrganizationType.Should().Be(CacheManager.TypesCache.GetByValue <OrganizationType>(source.TypeId.Value)); var targetAddress = target.Addresses.First(); var sourceAddress = source.OrganizationAddresses.First(); targetAddress.StreetAddress.Street.First().Value.Should().Be(sourceAddress.Address.AddressStreets.First().StreetNames.First().Name); targetAddress.Type.Should().Be(CacheManager.TypesCache.GetByValue <AddressCharacter>(sourceAddress.CharacterId)); targetAddress.Country.Should().Be(sourceAddress.Address.Country.Code); target.WebPages.First().Value.Should().Be(source.OrganizationWebAddress.First().WebPage.Name); target.Services.Count.Should().Be(3); target.DisplayNameType.First().Type.Should().Be(CacheManager.TypesCache.GetByValue <NameType>(source.OrganizationDisplayNameTypes.First().DisplayNameTypeId)); // check phones target.PhoneNumbers.Count.Should().Be(source.OrganizationPhones.Count); AssertPhone( target.PhoneNumbers.Single(p => p.Language == LanguageCode.fi.ToString()), source.OrganizationPhones.Single(p => p.Phone.LocalizationId == fiId).Phone ); AssertPhone( target.PhoneNumbers.Single(p => p.Language == LanguageCode.sv.ToString()), source.OrganizationPhones.Single(p => p.Phone.LocalizationId == svId).Phone ); // check emails target.EmailAddresses.Count.Should().Be(source.OrganizationEmails.Count); AssertEmail( target.EmailAddresses.Single(e => e.Language == LanguageCode.fi.ToString()), source.OrganizationEmails.Single(e => e.Email.LocalizationId == fiId).Email ); AssertEmail( target.EmailAddresses.Single(e => e.Language == LanguageCode.sv.ToString()), source.OrganizationEmails.Single(e => e.Email.LocalizationId == svId).Email ); }