< Summary

Information
Class: Gateway.Apis.Amqp.RegistrationExtensions.AsyncApiRegistration
Assembly: Gateway
File(s): /home/runner/work/dotnet-microservice/dotnet-microservice/Gateway/Apis/Amqp/RegistrationExtensions/AsyncApiRegistration.cs
Tag: 34_11887803474
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 29
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
.cctor()100%210%
AddAsyncApiHost(...)100%210%

File(s)

/home/runner/work/dotnet-microservice/dotnet-microservice/Gateway/Apis/Amqp/RegistrationExtensions/AsyncApiRegistration.cs

#LineLine coverage
 1using Gateway.Apis.Amqp.Orders;
 2using RabbitMQ.Client;
 3using Saunter;
 4
 5namespace Gateway.Apis.Amqp.RegistrationExtensions;
 6
 7public static class AsyncApiRegistration
 8{
 09    public static readonly VersionState VersionOne = new(new(1.0), true);
 10
 11    public static WebApplicationBuilder AddAsyncApiHost(this WebApplicationBuilder builder)
 12    {
 013        var connectionString = builder.Configuration.GetConnectionString("messagebroker");
 014        var rabbitMqUri = new Uri(connectionString!);
 015        var rabbitMqFactory = new ConnectionFactory { Uri = rabbitMqUri };
 16
 017        builder.Services.AddQueueConsumer<CreateOrderAsync, CreateOrderHandler>(VersionOne);
 018        builder.Services.AddHostedService<ConsumerHost>();
 019        builder.Services.AddSingleton<IConnectionFactory>(rabbitMqFactory);
 020        builder.Services.AddHealthChecks().AddRabbitMQ(rabbitMqUri, tags: []);
 21
 022        builder.Services.AddAsyncApiSchemaGeneration(options =>
 023        {
 024            AsyncApiDocumentationGenerationBag.Apply(options);
 025        });
 26
 027        return builder;
 28    }
 29}