コード例 #1
0
        public void Get()
        {
            var lookup = new NamedLookup("One", "Two", "Three", "Five", "six");
            var one    = lookup.Get <int>("One");
            var two    = lookup.Get <double>("Two");

            lookup.SetValues(1, 2.0, 3, 5, "SIXSIXSIX");
            Assert.AreEqual(1, one);
            Assert.AreEqual(2.0, two);

            lookup.SetValues(11, 22.2);
            Assert.AreEqual(11, one);
            Assert.AreEqual(22.2, two);
        }
コード例 #2
0
        public void GetValue()
        {
            var lookup = new NamedLookup("One", "Two", "Three", "Five", "six");

            using (lookup.SetValues(1, 2.0, 3, 5, "SIXSIXSIX"))
            {
                Assert.AreEqual(1, lookup.GetValue <int>("One"));
                Assert.AreEqual(2.0, lookup.GetValue <double>("Two"));
            }
            ExceptionUtility.Expect <NullReferenceException>(() => lookup.GetValue <int>("One"));
        }