public void GetValueBool_InvalidBool_ThrowsException() { string section = string.Empty; string name = string.Empty; string value = "1"; SiteOption.SiteOptionType type = SiteOption.SiteOptionType.Int; string description = string.Empty; SiteOption target = new SiteOption(DEFAULT_SITE_ID, section, name, value, type, description); int expected = 1; int actual = target.GetValueInt(); Assert.AreEqual(expected, actual); try { target.GetValueBool(); throw new Exception("GetValueBool should throw exception"); } catch (SiteOptionInvalidTypeException) { } }
public void GetValueInt_ValidInt_ReturnsInt() { string section = string.Empty; string name = string.Empty; string value = "1"; SiteOption.SiteOptionType type = SiteOption.SiteOptionType.Int; string description = string.Empty; SiteOption target = new SiteOption(DEFAULT_SITE_ID, section, name, value, type, description); int expected = 1; int actual = target.GetValueInt(); Assert.AreEqual(expected, actual); }
public void GetValueInt_InvalidInt_ThrowsException() { string section = string.Empty; string name = string.Empty; string value = "0"; SiteOption.SiteOptionType type = SiteOption.SiteOptionType.Bool; string description = string.Empty; SiteOption target = new SiteOption(DEFAULT_SITE_ID, section, name, value, type, description); bool actual = target.GetValueBool(); Assert.IsFalse(actual); try { target.GetValueInt(); throw new Exception("GetValueInt should throw exception"); } catch (SiteOptionInvalidTypeException) { } }