Beispiel #1
0
        private OperationFilterContext FilterContextFor(string actionFixtureName)
        {
            var fakeProvider   = new FakeApiDescriptionGroupCollectionProvider();
            var apiDescription = fakeProvider
                                 .Add("GET", "collection", actionFixtureName, typeof(XmlAnnotatedController))
                                 .ApiDescriptionGroups.Items.First()
                                 .Items.First();

            var methodInfo = (apiDescription.ActionDescriptor as ControllerActionDescriptor).MethodInfo;

            return(new OperationFilterContext(apiDescription, null, null, methodInfo));
        }
Beispiel #2
0
        private DocumentGenerator Subject(
            Action <FakeApiDescriptionGroupCollectionProvider> setupApis = null,
            Action <DocumentGeneratorOptions> setupAction = null)
        {
            var apiDescriptionsProvider = new FakeApiDescriptionGroupCollectionProvider();

            setupApis?.Invoke(apiDescriptionsProvider);

            var options = new DocumentGeneratorOptions();

            options.SwaggerDocs.Add("v1", new OpenApiInfo {
                Title = "API", Version = "v1"
            });

            setupAction?.Invoke(options);

            return(new DocumentGenerator(
                       apiDescriptionsProvider,
                       new SchemaGenerator(new JsonSerializerSettings(), new SchemaGeneratorOptions()),
                       options
                       ));
        }