< Summary

Information
Line coverage
95%
Covered lines: 60
Uncovered lines: 3
Coverable lines: 63
Total lines: 106
Line coverage: 95.2%
Branch coverage
62%
Covered branches: 5
Total branches: 8
Branch coverage: 62.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
<Main>$()62.5%8895.23%

File(s)

/home/runner/work/Northwind-Api/Northwind-Api/src/Api/Program.cs

#LineLine coverage
 1using Api;
 2using Api.Middleware;
 3using Api.Request.Parameters;
 4using Api.Request.Validation;
 5using Api.ServiceExtension;
 6using Application;
 7using Domain;
 8using FluentValidation;
 9using FluentValidation.AspNetCore;
 10using Infrastructure;
 11using Serilog;
 12
 113var builder = WebApplication.CreateBuilder(args);
 14
 115builder.Host.UseSerilog();
 116builder.Services.AddDefaultLogger(builder.Configuration);
 17
 118builder.Services.AddOpenTelemetryWithExporters(
 119    builder.Configuration,
 120    TelemetryExporters.Jaeger | TelemetryExporters.Zipkin);
 21
 122builder.Services.AddDefaultProblemDetails();
 123builder.Services.AddDefaultApiVersioning();
 124builder.Services.AddDefaultResponseCompression();
 125builder.Services.AddDefaultSwaggerGeneration();
 26
 127builder.Services.AddSwaggerGen();
 28
 129builder.Services.AddDomain();
 130builder.Services.AddInfrastructure(
 131  builder.Environment,
 132  builder.Configuration
 133);
 134builder.Services.AddApplication();
 35
 136builder.Services.AddProblemDetails();
 137builder.Services.AddExceptionHandler<GlobalExceptionHandler>();
 38
 139builder.Services.AddControllers();
 140builder.Services.AddEndpointsApiExplorer();
 141builder.Services.AddSwaggerGen();
 42
 143builder.Services.AddMemoryCache();
 44
 145builder.Services.AddHttpContextAccessor();
 46
 147builder.Services
 148  .AddFluentValidationAutoValidation(fv => {
 149    fv.DisableDataAnnotationsValidation = true;
 150  })
 151  .AddValidatorsFromAssemblyContaining<CustomerRequestValidator>();
 52
 153builder.Services
 154  .AddControllers(options => {
 155    options.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = true;
 156  })
 157  .AddJsonOptions(opts => {
 158    opts.JsonSerializerOptions.WriteIndented = false;
 259  });
 60
 61
 162builder.Services.AddSingleton<Banner>();
 63
 164var app = builder.Build();
 65
 166app.UseExceptionHandler();
 167app.UseStatusCodePages();
 68
 169app.UseHttpsRedirection();
 70
 171app.UseAuthorization();
 72
 173app.MapControllers();
 74
 175app.UseResponseCompression();
 76
 277if (app.Environment.IsDevelopment() || app.Environment.IsProduction()) {
 178  app.UseSwagger();
 279  app.UseSwaggerUI(options => {
 180    options.SwaggerEndpoint("/swagger/v1/swagger.json", "Northwind Api V1");
 181    options.DefaultModelRendering(Swashbuckle.AspNetCore.SwaggerUI.ModelRendering.Model);
 182    options.ConfigObject.AdditionalItems["syntaxHighlight"] = false;
 183    options.RoutePrefix = "swagger";
 284  });
 185}
 86
 287if (app.Environment.IsDevelopment() || app.Environment.IsStaging()) {
 188  app.UseDeveloperExceptionPage();
 189}
 090else {
 091  app.UseExceptionHandler();
 092}
 93
 94
 95
 96//app.MapHealthChecks(
 97//  "_health",
 98//  new HealthCheckOptions() {
 99//    ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
 100//  });
 101
 2102using (var banner = app.Services.GetRequiredService<Banner>()) {
 1103  banner.LogBanner();
 1104}
 105
 1106await app.RunAsync();

Methods/Properties

<Main>$()