public string GetDescription(CultureInfo lang) { if (this.LocalizedList != null && this.LocalizedList.Count > 0) { LocalizedUnit descr = this.LocalizedList.FirstOrDefault(d => d.Language == lang.Name); if (descr != null) return descr.Value; else return null; } else return null; }
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"); }