コード例 #1
0
        public void GetValueNullValueTest()
        {
            var values = new Dictionary <String, Object>
            {
                { "MyString", null }
            };
            var target = new LookuptValueProvider(values);

            var value = target.GetValue("MyString");

            value.Should()
            .BeNull();
        }
コード例 #2
0
        public void GetValueFalseFormatTest()
        {
            var values = new Dictionary <String, Object>
            {
                { "MyInt", DateTime.Now }
            };
            var target = new LookuptValueProvider(values);

            var actual = target.GetValue("MyInt:DD");

            actual.Should()
            .Be("DD");
        }
コード例 #3
0
        public void GetValueMissingKeyWithFormatTest()
        {
            var values = new Dictionary <String, Object>
            {
                { "MyString", "asdf" }
            };
            var target = new LookuptValueProvider(values);

            Action test = () => target.GetValue("MyInt:000");

            test.ShouldThrow <FormatException>()
            .WithInnerException <KeyNotFoundException>();
        }
コード例 #4
0
        public void GetValueMissingKeyWithFormatTest()
        {
            var values = new Dictionary <String, Object>
            {
                { "MyString", "asdf" }
            };
            var target = new LookuptValueProvider(values);

            Action test      = () => target.GetValue("MyInt:000");
            var    exception = Assert.Throws <FormatException>(test);

            Assert.IsType <KeyNotFoundException>(exception.InnerException);
        }
コード例 #5
0
        public void GetValueNoneStringTest()
        {
            var values = new Dictionary <String, Object>
            {
                { "MyString", "asdf" },
                { "MyInt", 1234 }
            };
            var target = new LookuptValueProvider(values);

            var value = target.GetValue("MyInt");

            value.Should()
            .Be("1234");
        }