Exemple #1
0
        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)
            {
            }
        }
Exemple #2
0
 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);
 }
Exemple #3
0
 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)
     {
     }
 }