示例#1
0
        public void Successful_match_should_allow_getting_nullable_types_from_matches()
        {
            // given
            var matches = new Dictionary <string, object>
            {
                { "key", "5" }
            };
            var templateMatches = new UriTemplateMatches(matches);

            // when
            var actualValue = templateMatches.Get <int?>("key");

            // then
            actualValue.Should().Be(5);
        }
示例#2
0
        public void Successful_match_should_get_converted_values_for_existing_key()
        {
            // given
            var matches = new Dictionary <string, object>
            {
                { "key", "5" }
            };
            var templateMatches = new UriTemplateMatches(matches);

            // when
            var actualValue = templateMatches.Get <int>("key");

            // then
            actualValue.Should().Be(5);
        }
示例#3
0
        public void Successful_match_should_get_values_as_is_when_no_conversions_required()
        {
            // given
            var list    = new List <int>();
            var matches = new Dictionary <string, object>
            {
                { "key", list }
            };
            var templateMatches = new UriTemplateMatches(matches);

            // when
            var actualValue = templateMatches.Get <List <int> >("key");

            // then
            actualValue.Should().BeSameAs(list);
        }