コード例 #1
0
        public void WhenUsingAnEmptyLookupDictionaryThenNoRouteIsMatched()
        {
            var lookup = new ProxiedApiRouteEndpointLookup(new Dictionary <string, string>());

            var found = lookup.TryGet("/non-existent-route", out _);

            Assert.False(found);
        }
コード例 #2
0
        public void WhenLookingUpANonExistentRouteThenNothingIsFound(string nonExistentRoute)
        {
            var lookup = new ProxiedApiRouteEndpointLookup(new Dictionary <string, string>
            {
                ["test-route"]         = "test-endpoint",
                ["another-test-route"] = "another-test-endpoint"
            });

            var found = lookup.TryGet(nonExistentRoute, out _);

            Assert.False(found);
        }
コード例 #3
0
        public void WhenLookingUpExistingRouteThenItIsFound(string route, string expectedEndpoint)
        {
            var lookup = new ProxiedApiRouteEndpointLookup(
                new Dictionary <string, string>
            {
                ["test-route"]         = "test-endpoint",
                ["another-test-route"] = "another-test-endpoint"
            });

            var found = lookup.TryGet(route, out var endpoint);

            Assert.True(found);
            Assert.Equal(expectedEndpoint, endpoint);
        }