public void GetValueString_InvalidString_ThrowsException() { string section = string.Empty; string name = string.Empty; string value = "1"; SiteOption.SiteOptionType type = SiteOption.SiteOptionType.Bool; string description = string.Empty; SiteOption target = new SiteOption(DEFAULT_SITE_ID, section, name, value, type, description); try { target.GetValueString(); throw new Exception("GetValueString should throw exception"); } catch (SiteOptionInvalidTypeException) { } }
private static bool CheckStringSiteOptionChanged(List<SiteOption> updatedOptions, Dictionary<string, string[]> values, SiteOption so, string key, bool optionChanged, SiteOption update) { String newValue = (String)values[key].GetValue(0); if (update.GetValueString() != newValue) { update.SetValueString(newValue); updatedOptions.Add(update); optionChanged = true; } return optionChanged; }
public void GetValueString_ValidString_ReturnsString() { string section = string.Empty; string name = string.Empty; string value = "1"; SiteOption.SiteOptionType type = SiteOption.SiteOptionType.String; string description = string.Empty; SiteOption target = new SiteOption(DEFAULT_SITE_ID, section, name, value, type, description); string expected = "1"; string actual = target.GetValueString(); Assert.AreEqual(expected, actual); }