Пример #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");
        }
Пример #2
0
        public void Localized_UpdateDescription_IfDescriptionExistsUpdate_IfNotCreateNewOnThisLanguage()
        {
            //arrange
            Localized loc = new Localized("en-US", "White Rice with Corn");

            //act
            loc.UpdateDescription("en-US", "Potato");

            //Assert

            Assert.AreEqual(loc.GetDescription("en-US"), "Potato");
        }