Spontaneous.DataModel.Localized.AddDescription C# (CSharp) Method

AddDescription() public method

public AddDescription ( CultureInfo lang, string value ) : void
lang System.Globalization.CultureInfo
value string
return 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

        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");
        }