public void Apply_WhenEntityExists_DontAddDefinitions()
        {
            var swaggerDoc = new OpenApiDocument();

            swaggerDoc.Paths      = new OpenApiPaths();
            swaggerDoc.Components = new OpenApiComponents()
            {
                Schemas = new Dictionary <string, OpenApiSchema>()
            };
            var filter = new AutoAPISwaggerDocumentFilter();

            filter.Apply(swaggerDoc, null);

            Assert.Equal(3, swaggerDoc.Components.Schemas.Count);
            Assert.Equal("book", swaggerDoc.Components.Schemas.Keys.ToList()[1]);
        }
        public void Apply_WhenEntity_AddPaths()
        {
            var swaggerDoc = new OpenApiDocument();

            swaggerDoc.Paths      = new OpenApiPaths();
            swaggerDoc.Components = new OpenApiComponents()
            {
                Schemas = new Dictionary <string, OpenApiSchema>()
            };
            var filter = new AutoAPISwaggerDocumentFilter();

            filter.Apply(swaggerDoc, null);

            Assert.Equal(2, APIConfiguration.AutoAPIEntityCache.Count);
            Assert.Equal(7, swaggerDoc.Paths.Count);
        }
        public void Apply_WhenEntity_AddDefinitions()
        {
            var swaggerDoc = new OpenApiDocument();

            swaggerDoc.Paths      = new OpenApiPaths();
            swaggerDoc.Components = new OpenApiComponents()
            {
                Schemas = new Dictionary <string, OpenApiSchema>()
            };
            var filter = new AutoAPISwaggerDocumentFilter();


            filter.Apply(swaggerDoc, null);

            Assert.Equal(3, swaggerDoc.Components.Schemas.Count);
            Assert.Equal("author", swaggerDoc.Components.Schemas.First().Key);
        }