Esempio n. 1
0
 private void CheckTranslations(StatutoryServiceGeneralDescriptionVersioned source, VmOpenApiGeneralDescriptionVersionBase target)
 {
     target.Names.First().Value.Should().Be(source.Names.First().Name);
     target.Descriptions.First().Value.Should().NotBeSameAs(source.Descriptions.First().Description);
     target.Descriptions.First().Type.Should().Be(CacheManager.TypesCache.GetByValue <DescriptionType>(source.Descriptions.First().TypeId));
     target.ServiceClasses.Count.Should().Be(1);
     target.TargetGroups.First().Name.First().Value.Should().Be(source.TargetGroups.First().TargetGroup.Names.First().Name);
     target.OntologyTerms.First().Uri.Should().Be(source.OntologyTerms.First().OntologyTerm.Uri);
     target.ServiceClasses.First().Name.First().Value.Should().Be(source.ServiceClasses.First().ServiceClass.Names.First().Name);
     target.Languages.Count.Should().Be(2);
 }
Esempio n. 2
0
        public void TranslateGeneralDescriptionToVm()
        {
            var description = new StatutoryServiceGeneralDescriptionVersioned()
            {
                Descriptions = new List <StatutoryServiceDescription>()
                {
                    new StatutoryServiceDescription()
                    {
                        Description    = "TestDesc123Short",
                        LocalizationId = CacheManager.LanguageCache.Get(LanguageCode.fi),
                        TypeId         = DescriptionTypeEnum.ShortDescription.ToString().GetGuid()
                    },
                    new StatutoryServiceDescription()
                    {
                        Description    = "TestDesc123Long",
                        LocalizationId = CacheManager.LanguageCache.Get(LanguageCode.fi),
                        TypeId         = DescriptionTypeEnum.Description.ToString().GetGuid()
                    }
                },
                Names = new List <StatutoryServiceName>()
                {
                    new StatutoryServiceName()
                    {
                        Name           = "Desc123Name",
                        LocalizationId = CacheManager.LanguageCache.Get(LanguageCode.fi),
                        TypeId         = NameTypeEnum.Name.ToString().GetGuid()
                    }
                },
                ServiceClasses = new List <StatutoryServiceServiceClass>()
                {
                    new StatutoryServiceServiceClass()
                    {
                        ServiceClass = new ServiceClass()
                        {
                            Label = "SomeServiceClass"
                        }
                    },
                    new StatutoryServiceServiceClass()
                    {
                        ServiceClass = new ServiceClass()
                        {
                            Label = "AnotherServiceClass"
                        }
                    }
                },
                TargetGroups = new List <StatutoryServiceTargetGroup>()
                {
                    new StatutoryServiceTargetGroup()
                    {
                        TargetGroup = new TargetGroup()
                        {
                            Label = "SomeTargetGroup"
                        }
                    }
                }
            };
            var toTranslate = new List <StatutoryServiceGeneralDescriptionVersioned>()
            {
                description
            };
            var translated = RunTranslationEntityToModelTest <StatutoryServiceGeneralDescriptionVersioned, VmGeneralDescriptionListItem>(new List <ITranslator>()
            {
                generalDescriptionTranslator, statutoryDescriptionStringTranslator, statutoryServiceClassVmListItemTranslator, targetGroupVmListTranslator, statutoryServiceNameStringTranslator, versionTranslator
            }, toTranslate);

            translated.Count.Should().Be(1);
            var target = translated.First();

            //target.Name.Should().ContainValue("Desc123Name");
            target.ServiceClasses.Count.Should().Be(2);
            target.ShortDescription.Should().ContainValue("TestDesc123Short");
            target.Description.Should().ContainValue("TestDesc123Long");
        }
Esempio n. 3
0
 private void CheckTranslations(IVmOpenApiGeneralDescriptionInVersionBase source, StatutoryServiceGeneralDescriptionVersioned target)
 {
     target.Names.First().Name.Should().Be(source.Names.First().Value);
     target.Descriptions.First().Description.Should().Be(source.Descriptions.First().Value);
     target.Languages.FirstOrDefault(lc => lc.Language.Code == LanguageCode.fi.ToString()).Should().NotBeNull();
     target.Languages.FirstOrDefault(lc => lc.Language.Code == LanguageCode.sv.ToString()).Should().NotBeNull();
     target.ServiceClasses.First().ServiceClass.Uri.Should().Be(source.ServiceClasses.First());
     target.OntologyTerms.First().OntologyTerm.Uri.Should().Be(source.OntologyTerms.First());
     target.TargetGroups.First().TargetGroup.Uri.Should().Be(source.TargetGroups.First());
     target.LifeEvents.First().LifeEvent.Uri.Should().Be(source.LifeEvents.First());
 }
Esempio n. 4
0
 public GetGeneralDescriptionVersionBaseTests()
 {
     _gdList        = EntityGenerator.GetGeneralDescriptionEntityList(1, PublishingStatusCache);
     _publishedGd   = _gdList.Where(o => o.PublishingStatusId == PublishedId).FirstOrDefault();
     _publishedGdId = _publishedGd.Id;
 }