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(); }
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); }
public void EndpointFilterFactory_ShouldParseEndpoints(string endpoint) { // Act Assert.DoesNotThrow(() => EndpointFilterFactory.CreateEndpointFilter(endpoint)); }