public void GetDocs( SwaggerAggregateRoute aggregateRoute, IEnumerable <RouteDocs> routeDocs, OpenApiOperation expected) { IRoutesDocumentationProvider provider = Substitute.For <IRoutesDocumentationProvider>(); provider.GetRouteDocs(Arg.Any <IEnumerable <string> >(), Arg.Any <IEnumerable <RouteOptions> >()) .Returns(routeDocs); var generator = new AggregateRouteDocumentationGenerator( Routes, provider, Substitute.For <IDefinedAggregatorProvider>(), AggregateRouteDocumentationGenerator.DefaultPostProcess, Substitute.For <ISchemaGenerator>()); OpenApiPathItem docs = generator.GenerateDocs(aggregateRoute, new OpenApiDocument()); OpenApiOperation actual = docs.Operations.First().Value; actual.Summary.Should().Be(expected.Summary); actual.Description.Should().Be(expected.Description); actual.Parameters.Should().HaveCount(expected.Parameters.Count); for (int i = 0; i < expected.Parameters.Count; i++) { actual.Parameters[i].Name.Should().Be(expected.Parameters[i].Name); actual.Parameters[i].In.Should().Be(expected.Parameters[i].In); actual.Parameters[i].Description.Should().Be(expected.Parameters[i].Description); } }
public OpenApiPathItem GenerateDocs(SwaggerAggregateRoute aggregateRoute, OpenApiDocument openApiDocument) { IEnumerable <RouteDocs> routes = _routesDocumentationProvider.GetRouteDocs(aggregateRoute.RouteKeys, _routes.Value); OpenApiPathItem docs = GenerateDocs(aggregateRoute, routes, openApiDocument); _postProcess(aggregateRoute, routes, docs, openApiDocument); return(docs); }