Added test for APIs
This commit is contained in:
@ -10,8 +10,7 @@ public record AppSettings(string BuildNumber,
|
||||
bool IsDevelopment,
|
||||
bool IsStaging,
|
||||
string MonAResource,
|
||||
string MonASite,
|
||||
string URLs)
|
||||
string MonASite)
|
||||
{
|
||||
|
||||
public override string ToString()
|
||||
|
@ -17,7 +17,6 @@ public class AppSettings
|
||||
[Display(Name = "Is Staging"), Required] public bool? IsStaging { get; set; }
|
||||
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
||||
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
||||
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
||||
|
||||
#nullable enable
|
||||
|
||||
@ -50,8 +49,6 @@ public class AppSettings
|
||||
throw new NullReferenceException(nameof(MonAResource));
|
||||
if (appSettings.MonASite is null)
|
||||
throw new NullReferenceException(nameof(MonASite));
|
||||
if (appSettings.URLs is null)
|
||||
throw new NullReferenceException(nameof(URLs));
|
||||
result = new(
|
||||
appSettings.BuildNumber,
|
||||
appSettings.Company,
|
||||
@ -61,8 +58,7 @@ public class AppSettings
|
||||
appSettings.IsDevelopment.Value,
|
||||
appSettings.IsStaging.Value,
|
||||
appSettings.MonAResource,
|
||||
appSettings.MonASite,
|
||||
appSettings.URLs);
|
||||
appSettings.MonASite);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,9 @@ using ReportingServices.API.Models;
|
||||
using ReportingServices.Shared.Repositories;
|
||||
using Serilog;
|
||||
|
||||
internal class Program
|
||||
namespace ReportingServices.API;
|
||||
|
||||
public class Program
|
||||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
@ -10,7 +12,7 @@ internal class Program
|
||||
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
_ = builder.Configuration.AddUserSecrets<Program>();
|
||||
AppSettings appSettings = ReportingServices.API.Models.Binder.AppSettings.Get(builder.Configuration);
|
||||
AppSettings appSettings = Models.Binder.AppSettings.Get(builder.Configuration);
|
||||
Environment.SetEnvironmentVariable("workingDirectory", appSettings.LoggingDirectory);
|
||||
_ = loggerConfiguration.ReadFrom.Configuration(builder.Configuration);
|
||||
_ = builder.Host.UseSerilog();
|
||||
|
Reference in New Issue
Block a user