Spontaneous.DataModel.Localized.AddDescription C# (CSharp) Метод

AddDescription() публичный Метод

public AddDescription ( CultureInfo lang, string value ) : void
lang System.Globalization.CultureInfo
value string
Результат void
        public void AddDescription(CultureInfo lang, string value)
        {
            this.LocalizedList.Add(new LocalizedUnit(lang, value));
        }

Same methods

Localized::AddDescription ( string lang, string value ) : void

Usage Example

Пример #1
0
        public void LocalizedTest_ShouldCreateNewObjectFromCultureInfoObjectAndValue()
        {
            //arrange
            Localized testLocalized1 = new Localized("testValue1");
            Localized testLocalized2 = new Localized(new CultureInfo("ru-RU", false) , "testValue2");

            //act
            testLocalized2.AddDescription(new CultureInfo("he-IL", false), "testValue3");

            //assert
            Assert.IsNotNull(testLocalized1);
            Assert.IsNotNull(testLocalized1.LocalizedList);
            Assert.AreEqual(testLocalized1.LocalizedList[0].Language, "en-US");
            Assert.AreEqual(testLocalized1.LocalizedList[0].Value, "testValue1");

            Assert.IsNotNull(testLocalized2);
            Assert.IsNotNull(testLocalized2.LocalizedList);
            Assert.AreEqual(testLocalized2.LocalizedList[0].Language, "ru-RU");
            Assert.AreEqual(testLocalized2.LocalizedList[0].Value, "testValue2");
            Assert.AreEqual(testLocalized2.LocalizedList[1].Language, "he-IL");
            Assert.AreEqual(testLocalized2.LocalizedList[1].Value, "testValue3");
        }