예제 #1
0
        public void EndpointFilter_Should_GetEndpointsOnlyWithHttpMethodAndWildcardedEndpoint()
        {
            // Arrange
            var             endpointFilter = EndpointFilterFactory.CreateEndpointFilter("GET:/api/Pets*");
            List <Endpoint> endpoints      = GetPetstoreEndpoints();

            // Act
            var filteredEndpoints = endpoints.Where(x => endpointFilter.MatchEndpoint(x.HttpMethod, x.EndpointPath)).ToList();

            // Assert
            filteredEndpoints.All(x => x.HttpMethod == "GET" && x.HttpMethod.StartsWith("/api/Pets")).Should().BeTrue();
        }
예제 #2
0
        public void EndpointFilterFactory_Should_GetAllEndpoints()
        {
            // Arrange
            var endpointFilter = EndpointFilterFactory.CreateEndpointFilter("/*");
            var endpoints      = GetPetstoreEndpoints();

            // Act
            var filteredEndpoints = endpoints.Where(p => endpointFilter.MatchEndpoint(p.HttpMethod, p.EndpointPath)).ToList();

            // Assert
            filteredEndpoints.Should().HaveCount(endpoints.Count);
            filteredEndpoints.Should().BeEquivalentTo(endpoints);
        }
예제 #3
0
 public void EndpointFilterFactory_ShouldParseEndpoints(string endpoint)
 {
     // Act
     Assert.DoesNotThrow(() => EndpointFilterFactory.CreateEndpointFilter(endpoint));
 }