Esempio n. 1
0
        public void ShouldReturnCorrectOptionValueForSpecificLanguage7()
        {
            Language lang = new Language();

            lang.Id = Guid.NewGuid();
            var option1 = TestDataProvider.CreateNewContentOption();

            option1.Type = OptionType.Text;
            var optionValue1 = TestDataProvider.CreateNewChildContentOption();

            optionValue1.Key  = option1.Key;
            optionValue1.Type = option1.Type;
            var valueTranslation = new ChildContentOptionTranslation();

            valueTranslation.Language           = lang;
            valueTranslation.Value              = TestDataProvider.ProvideRandomString(100);
            valueTranslation.ChildContentOption = optionValue1;
            optionValue1.Translations.Add(valueTranslation);
            var service = CreateOptionService();
            var options = new List <IOptionEntity> {
                option1
            };
            var optionValues = new List <IOptionValueEntity> {
                optionValue1
            };

            var result = service.GetMergedOptionValues(options, optionValues, lang.Id);

            Assert.NotNull(result);
            Assert.AreEqual(valueTranslation.Value, result[0].Value);
        }
Esempio n. 2
0
        public void ShouldReturnCorrectOptionValueForDefaultLanguage3()
        {
            Language lang = new Language();

            lang.Id = Guid.NewGuid();
            var option1 = TestDataProvider.CreateNewContentOption();

            option1.Type = OptionType.Text;
            var optionValue1 = TestDataProvider.CreateNewChildContentOption();

            optionValue1.Key  = option1.Key;
            optionValue1.Type = option1.Type;

            var service = CreateOptionService();
            var options = new List <IOptionEntity> {
                option1
            };
            var optionValues = new List <IOptionValueEntity> {
                optionValue1
            };

            var result = service.GetMergedOptionValues(options, optionValues);

            Assert.NotNull(result);
            Assert.AreEqual(optionValue1.Value, result[0].Value);
        }