InfinityQSV2

This commit is contained in:
2023-02-25 12:39:34 -07:00
parent 8e15b6a3a5
commit 97c9c3c264
59 changed files with 142046 additions and 2119 deletions

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.Models.Stateless;
using Serilog;
using System.Net;
@ -36,12 +37,22 @@ public class UnitTestAppSettingsController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void TestConnectionString()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IAppSettingsRepository<Server.Models.Binder.AppSettings> appSettingsRepository = serviceProvider.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
appSettingsRepository.VerifyConnectionStrings();
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void AppSettings()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
Server.Models.AppSettings appSettings = serviceProvider.GetRequiredService<Server.Models.AppSettings>();
AppSettings appSettings = serviceProvider.GetRequiredService<AppSettings>();
Assert.IsNotNull(appSettings);
_Logger.Information($"{_TestContext?.TestName} completed");
}
@ -67,7 +78,7 @@ public class UnitTestAppSettingsController
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
string json = await httpResponseMessage.Content.ReadAsStringAsync();
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetAppSettingsApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetAppSettings)}.json"), json);
Assert.IsNotNull(json);
Assert.IsTrue(json != "[]");
_Logger.Information($"{_TestContext?.TestName} completed");
@ -94,7 +105,7 @@ public class UnitTestAppSettingsController
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
string json = await httpResponseMessage.Content.ReadAsStringAsync();
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetBuildNumberAndGitCommitSevenApi)}.json"), json);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetBuildNumberAndGitCommitSeven)}.json"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
}