Пример #1
0
        public void hash_values_with_a_route_That_has_substitutions()
        {
            var chain = new RoutedChain(RouteBuilder.Build<Query>("some/pattern/url/{from}/{to}"));

            var currentChain = new CurrentChain(chain, new Dictionary<string, object>{{"from", 1}, {"to", 2}});
            var varyBy = new VaryByResource(currentChain);

            var values = varyBy.Values();
            values.Select(x => "{0}={1}".ToFormat(x.Key, x.Value))
                .ShouldHaveTheSameElementsAs("chain=" + "some/pattern/url/{from}/{to}", "from=1", "to=2");
        }
Пример #2
0
        public void hash_values_when_the_chain_has_a_route_but_not_real_values()
        {
            var chain = new RoutedChain(new RouteDefinition("some/pattern/url"));

            var currentChain = new CurrentChain(chain, new Dictionary<string, object>());

            var varyBy = new VaryByResource(currentChain);

            var values = varyBy.Values();
            values.Select(x => "{0}={1}".ToFormat(x.Key, x.Value)).ShouldHaveTheSameElementsAs("chain=" + chain.GetRoutePattern());
        }
Пример #3
0
        public void hash_values_with_a_chain_that_is_a_partial()
        {
            var chain = new BehaviorChain()
            {

            };

            var currentChain = new CurrentChain(chain, new Dictionary<string, object> { { "from", 1 }, { "to", 2 } });
            var varyBy = new VaryByResource(currentChain);

            var values = varyBy.Values();
            values.Select(x => "{0}={1}".ToFormat(x.Key, x.Value))
                .ShouldHaveTheSameElementsAs("chain=" + chain.ToString());
        }
Пример #4
0
        public void hash_values_with_a_chain_that_is_a_partial()
        {
            var chain = new BehaviorChain()
            {
                Route = RouteBuilder.Build<Query>("some/pattern/url/{from}/{to}"),
                IsPartialOnly = true

            };

            var currentChain = new CurrentChain(chain, new Dictionary<string, object> { { "from", 1 }, { "to", 2 } });
            var varyBy = new VaryByResource(currentChain);

            var values = varyBy.Values();
            values.Select(x => "{0}={1}".ToFormat(x.Key, x.Value))
                .ShouldHaveTheSameElementsAs("chain=" + chain.UniqueId.ToString());
        }