GetInt() public method

public GetInt ( string key, string alias ) : int
key string
alias string
return int
Example #1
0
        public void GetInt() {
            AliasText alias = new AliasText();

            Assert.IsFalse(alias.ContainsInt("error code", "warn"));
            Assert.IsFalse(alias.ContainsInt("error code", "error"));
            alias.AddAlias("error code", "WaRn", 100);
            alias.AddAlias("error code", "ErroR", 200);

            Assert.IsTrue(alias.ContainsInt("error code", "warn"));
            Assert.IsTrue(alias.ContainsInt("error code", "error"));

            Assert.AreEqual(100, alias.GetInt("error code", "warn"));
            Assert.AreEqual(200, alias.GetInt("error code", "ErroR"));
        }
Example #2
0
        public void GetInt()
        {
            AliasText alias = new AliasText();

            Assert.IsFalse(alias.ContainsInt("error code", "warn"));
            Assert.IsFalse(alias.ContainsInt("error code", "error"));
            alias.AddAlias("error code", "WaRn", 100);
            alias.AddAlias("error code", "ErroR", 200);

            Assert.IsTrue(alias.ContainsInt("error code", "warn"));
            Assert.IsTrue(alias.ContainsInt("error code", "error"));

            Assert.AreEqual(100, alias.GetInt("error code", "warn"));
            Assert.AreEqual(200, alias.GetInt("error code", "ErroR"));
        }
Example #3
0
        public void GetIntEnum()
        {
            AliasText alias = new AliasText();

            alias.AddAlias("node type", new System.Xml.XmlNodeType());

            Assert.AreEqual((int)System.Xml.XmlNodeType.Text,
                            alias.GetInt("node type", "teXt"));
            Assert.AreEqual((int)System.Xml.XmlNodeType.Attribute,
                            alias.GetInt("node type", "aTTribute"));

            try {
                alias.GetInt("node type", "not here");
            }
            catch {}
        }
Example #4
0
        public void GetIntNonExistantKey()
        {
            AliasText alias = new AliasText();

            alias.AddAlias("error code", "WaRn", 100);

            Assert.AreEqual(100, alias.GetInt("not exist", "warn"));
        }
Example #5
0
        public void GetIntEnum() {
            AliasText alias = new AliasText();
            alias.AddAlias("node type", new System.Xml.XmlNodeType());

            Assert.AreEqual((int)System.Xml.XmlNodeType.Text,
                            alias.GetInt("node type", "teXt"));
            Assert.AreEqual((int)System.Xml.XmlNodeType.Attribute,
                            alias.GetInt("node type", "aTTribute"));

            try {
                alias.GetInt("node type", "not here");
            }
            catch {}
        }
Example #6
0
        public void GetIntNonExistantKey() {
            AliasText alias = new AliasText();
            alias.AddAlias("error code", "WaRn", 100);

            Assert.AreEqual(100, alias.GetInt("not exist", "warn"));
        }