예제 #1
0
        public void InvalidSetTest()
        {
            var locator = new CodeConfigLocator();

            ExceptionAssert.Throws <ArgumentNullException>(() =>
            {
                locator.Set(null, "name");
            });
        }
예제 #2
0
        public void InvalidTryGetValueTest()
        {
            var locator = new CodeConfigLocator();

            ExceptionAssert.Throws <ArgumentNullException>(() =>
            {
                string str;
                locator.TryGetValue(null, out str);
            });
        }
예제 #3
0
        public void SetTest()
        {
            var locator = new CodeConfigLocator();

            ExceptionAssert.DoesNotThrow(() =>
            {
                locator.Set("name", "name");
                locator.Set("name2", null);
            });
        }
예제 #4
0
        public void TryGetValueTest()
        {
            var locator = new CodeConfigLocator();

            locator.Set("hello", "world");

            string str;

            if (!locator.TryGetValue("hello", out str))
            {
                Assert.Fail("can not get [hello]");
            }

            Assert.AreEqual("world", str);

            if (locator.TryGetValue("123", out str))
            {
                Assert.Fail();
            }

            Assert.AreEqual(null, str);
        }