Esempio n. 1
0
        public void TestParseInt()
        {
            Config cfg = new Config(VALID_APPNAME);

            Assert.AreEqual(1, cfg.GetParameterAsInt("TypedData", "Int1"));
            Assert.AreEqual(0, cfg.GetParameterAsInt("TypedData", "Int2"));
            Assert.AreEqual(-1, cfg.GetParameterAsInt("TypedData", "Int3"));
            bool threw = false;
            try
            {
                cfg.GetParameterAsInt("TypedData", "CantParse");
            }
            catch
            {
                threw = true;
            }
            Assert.IsTrue(threw, "Failed to throw when parsing invalid input.");
        }