< Summary

Information
Line coverage
0%
Covered lines: 0
Uncovered lines: 39
Coverable lines: 39
Total lines: 67
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
<Main>$(...)0%620%

File(s)

/Users/tiagoamaral/Workspace/desafio/event-list-api/Src/Core/Program.cs

#LineLine coverage
 1/*
 2* Program.cs
 3* event-list
 4*
 5* Created by Tiago Amaral on 05/09/2025.
 6* Copyright ©2024 Tiago Amaral. All rights reserved.
 7*/
 8
 9using System.Reflection;
 10using Microsoft.EntityFrameworkCore;
 11
 12using event_list.modules.eventlist.infra;
 13using event_list.modules.eventlist.storage;
 14using event_list.modules.eventlist.services;
 15using event_list.shared.Middlewares;
 16
 017var builder = WebApplication.CreateBuilder(args);
 18
 19// Add services to the container.
 20// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
 021builder.Services.AddControllers();
 022builder.Services.AddEndpointsApiExplorer();
 023builder.Services.AddSwaggerGen( c => {
 024    var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
 025    var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
 026    c.IncludeXmlComments(xmlPath);
 027});
 28
 29// Removendo CORS
 030builder.Services.AddCors(options =>
 031{
 032    options.AddPolicy("AllowAll",
 033        policy =>
 034        {
 035            policy.AllowAnyOrigin()
 036                  .AllowAnyMethod()
 037                  .AllowAnyHeader();
 038        });
 039});
 40
 41// Custom Module
 042builder.Services.AddDbContext<EventListDbContext>(options =>
 043    options.UseInMemoryDatabase("EventListDb"));
 44
 045builder.Services.AddScoped<EventListDbContext>();
 046builder.Services.AddScoped<IEventListStorage, EventListStorage>();
 047builder.Services.AddScoped<IEventListDeleteByIdentifierService, EventListDeleteByIdentifierService>();
 048builder.Services.AddScoped<IEventListFetchByIdentifierService, EventListFetchByIdentifierService>();
 049builder.Services.AddScoped<IEventListFetchService, EventListFetchService>();
 050builder.Services.AddScoped<IEventListSaveService, EventListSaveService>();
 51
 052builder.Services.AddScoped<IEventListServices, EventListServices>();
 053builder.Services.AddScoped<EventListController>();
 54
 055var app = builder.Build();
 56
 57// Configure the HTTP request pipeline.
 058if (app.Environment.IsDevelopment()) {
 059    app.UseCors("AllowAll");
 060    app.UseSwagger();
 061    app.UseSwaggerUI();
 062}
 063app.UseMiddleware<CustomHeaderResponse>();
 064app.UseMiddleware<ExceptionMiddleware>();
 065app.MapControllers();
 066app.UseHttpsRedirection();
 067app.Run();

Methods/Properties

<Main>$(System.String[])