< Summary

Information
Class: Gateway.ServiceMetadataRegistration
Assembly: Gateway
File(s): /home/runner/work/dotnet-microservice/dotnet-microservice/Gateway/GlobalConfigurations/ServiceMetadata.cs
Tag: 34_11887803474
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
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
AddServiceMetadata(...)100%210%

File(s)

/home/runner/work/dotnet-microservice/dotnet-microservice/Gateway/GlobalConfigurations/ServiceMetadata.cs

#LineLine coverage
 1namespace Gateway;
 2
 3public class ServiceMetadata
 4{
 5    public required string ServiceName { get; set; }
 6    public Uri? BluePrintUri { get; set; }
 7    public required string Description { get; set; }
 8    public string? ContactEmail { get; set; }
 9    public string? ContactName { get; set; }
 10    public Uri? LicenseUri { get; set; }
 11    public required string License { get; set; }
 12    public Uri? TermsOfService { get; set; }
 13}
 14
 15public static class ServiceMetadataRegistration
 16{
 17    public static ServiceMetadata AddServiceMetadata(this WebApplicationBuilder builder)
 18    {
 019        builder.Services.Configure<ServiceMetadata>(
 020            builder.Configuration.GetRequiredSection(nameof(ServiceMetadata))
 021        );
 022        var serviceMetadata = new ServiceMetadata()
 023        {
 024            ServiceName = string.Empty,
 025            Description = string.Empty,
 026            License = string.Empty
 027        };
 28
 029        builder.Configuration.GetSection(nameof(ServiceMetadata)).Bind(serviceMetadata);
 030        return serviceMetadata;
 31    }
 32}