< Summary

Information
Class: Program
Assembly: IndeklimaWebApi
File(s): /home/runner/work/SEP4/SEP4/backend/microservices/indeklima/WebApi/Program.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 34
Coverable lines: 34
Total lines: 52
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)

/home/runner/work/SEP4/SEP4/backend/microservices/indeklima/WebApi/Program.cs

#LineLine coverage
 1using WebApi.DAO;
 2using WebApi.Services;
 3using SharedObjects.Auth;
 4
 05var builder = WebApplication.CreateBuilder(args);
 6
 7// Add services to the container.
 08builder.Services.AddControllers().AddNewtonsoftJson(options =>
 09{
 010    options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
 011});
 12// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
 013builder.Services.AddEndpointsApiExplorer();
 014builder.Services.AddSwaggerGen();
 15
 16// Register the MongoDbContext
 017builder.Services.AddSingleton<MongoDbContext>(sp =>
 018    new MongoDbContext(
 019        builder.Configuration.GetConnectionString("MongoDb"),
 020        "indeklima_db"
 021    )
 022);
 023builder.Services.AddScoped<ISensorDataService, SensorDataService>();
 024builder.Services.AddScoped<ISensorDataDAO, SensorDataDAO>();
 025builder.Services.AddScoped<ISensorGoalService, SensorGoalService>();
 026builder.Services.AddScoped<ISensorGoalDAO, SensorGoalDAO>();
 027builder.Services.AddScoped<IIOTControlService, IOTControlService>();
 28
 029AuthorizationPolicies.AddAuth(builder);
 30
 031var app = builder.Build();
 32
 33// Configure the HTTP request pipeline.
 034if (app.Environment.IsDevelopment())
 035{
 036    app.UseSwagger();
 037    app.UseSwaggerUI();
 038}
 39
 040app.UseCors(x => x
 041    .AllowAnyMethod()
 042    .AllowAnyHeader()
 043    .SetIsOriginAllowed(origin => true) // allow any origin
 044    .AllowCredentials());
 45
 046app.UseHttpsRedirection();
 47
 048app.UseAuthorization();
 49
 050app.MapControllers();
 51
 052app.Run();

Methods/Properties

<Main>$(System.String[])