< Summary

Information
Class: Gateway.Apis.Http.HttpApiRegistration
Assembly: Gateway
File(s): /home/runner/work/dotnet-microservice/dotnet-microservice/Gateway/Apis/Http/HttpApiRegistration.cs
Tag: 34_11887803474
Line coverage
0%
Covered lines: 0
Uncovered lines: 21
Coverable lines: 21
Total lines: 32
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
UseHttpApis(...)100%210%

File(s)

/home/runner/work/dotnet-microservice/dotnet-microservice/Gateway/Apis/Http/HttpApiRegistration.cs

#LineLine coverage
 1using Asp.Versioning.Builder;
 2
 3namespace Gateway.Apis.Http;
 4
 5public static class HttpApiRegistration
 6{
 7    public static WebApplication UseHttpApis(this WebApplication app, ApiVersionSet apiVersionSet)
 8    {
 09        app.MapGet("v{version:apiVersion}/{id:int}", (int id) => id)
 010            .ProducesValidationProblem()
 011            .Produces(200)
 012            .Produces(404)
 013            .WithApiVersionSet(apiVersionSet)
 014            .MapToApiVersion(2.0)
 015            .WithOpenApi();
 16
 017        app.MapGet(
 018                "v{version:apiVersion}/single/{id:int}",
 019                (int id) =>
 020                {
 021                    throw new Exception($"Oups {id}");
 022                }
 023            )
 024            .ProducesValidationProblem()
 025            .Produces(200)
 026            .Produces(404)
 027            .WithApiVersionSet(apiVersionSet)
 028            .MapToApiVersion(1.0)
 029            .WithOpenApi();
 030        return app;
 31    }
 32}