Summary

Class:ProjectX.PublicApi.Extensions.StartupSwagger
Assembly:ProjectX.PublicApi
File(s):C:\private\projects\projectx\backend\src\ProjectX.PublicApi\Startup\StartupSwagger.cs
Covered lines:33
Uncovered lines:0
Coverable lines:33
Total lines:52
Line coverage:100%
Branch coverage:50%

History

Metrics

MethodCyclomatic complexity  NPath complexity  Sequence coverage  Branch coverage  
AddDeveloperDocumentation(...)20100100
UseDeveloperDocumentation(...)20100100

File(s)

C:\private\projects\projectx\backend\src\ProjectX.PublicApi\Startup\StartupSwagger.cs

#LineLine coverage
 1using System.IO;
 2using Microsoft.AspNetCore.Builder;
 3using Microsoft.Extensions.DependencyInjection;
 4using Microsoft.Extensions.PlatformAbstractions;
 5using Swashbuckle.AspNetCore.Swagger;
 6
 7namespace ProjectX.PublicApi.Extensions
 8{
 9    public static class StartupSwagger
 10    {
 11        public static void AddDeveloperDocumentation(
 12            this IServiceCollection services)
 13        {
 114            services.AddSwaggerGen(c =>
 115            {
 216                c.SwaggerDoc("v1",
 217                    new Info
 218                    {
 219                        Title = "ProjectX.PublicApi",
 220                        Description = "Credentials: ce7c2123-0bc8-42eb-8a26-" +
 221                        "8e64c8e93514 e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4",
 222                        Version = "v1",
 223                    });
 124
 225                var filePath = Path.Combine(PlatformServices.Default
 226                    .Application.ApplicationBasePath,
 227                    "ProjectX.PublicApi.xml");
 128
 229                 if (File.Exists(filePath))
 130                {
 131                    c.IncludeXmlComments(filePath);
 132                }
 133
 234                c.DescribeAllEnumsAsStrings();
 235                c.DescribeStringEnumsInCamelCase();
 236                c.DescribeAllParametersInCamelCase();
 237            });
 138        }
 39
 40        public static void UseDeveloperDocumentation(
 41            this IApplicationBuilder app)
 42        {
 143            app.UseSwagger();
 144            app.UseSwaggerUI(c =>
 145            {
 246                c.SwaggerEndpoint("/swagger/v1/swagger.json",
 247                    "ProjectX.PublicApi");
 148
 249            });
 150        }
 51    }
 52}