CORS, Theme, Better flow and dotnet tools
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
using Expose.MyIT.Shared.Models.Stateless;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Serilog;
|
||||
@ -9,10 +10,14 @@ namespace Expose.MyIT.Tests;
|
||||
public class UnitTestAppSettingsController
|
||||
{
|
||||
|
||||
private static ILogger? _Logger;
|
||||
private static string? _ControllerName;
|
||||
private static TestContext? _TestContext;
|
||||
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||
#pragma warning disable CS8618
|
||||
|
||||
private static ILogger _Logger;
|
||||
private static string _ControllerName;
|
||||
private static TestContext _TestContext;
|
||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
||||
|
||||
#pragma warning restore
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitAsync(TestContext testContext)
|
||||
@ -26,40 +31,45 @@ public class UnitTestAppSettingsController
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
_Logger.Information("Starting Web Application");
|
||||
Assert.AreEqual(Shared.Models.Stateless.Methods.IAppSettingsController.GetRouteName(), _ControllerName);
|
||||
Assert.AreEqual(IAppSettingsController<object>.GetRouteName(), _ControllerName);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task Get_ShouldReturn()
|
||||
public void AppSettings()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
Server.Models.AppSettings appSettings = serviceProvider.GetRequiredService<Server.Models.AppSettings>();
|
||||
Assert.IsNotNull(appSettings);
|
||||
if (appSettings.IsDevelopment)
|
||||
{
|
||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/");
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
Assert.IsTrue(result.Contains(appSettings.Company));
|
||||
httpClient.Dispose();
|
||||
}
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetAppSettings()
|
||||
{
|
||||
_Logger.Information("Starting Web Application");
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
IAppSettingsRepository appSettingsRepository = serviceProvider.GetRequiredService<IAppSettingsRepository>();
|
||||
List<string> collection = appSettingsRepository.GetAppSettings();
|
||||
Assert.IsTrue(collection is not null);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetAppSettingsApi()
|
||||
{
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string actionName = nameof(IAppSettingsController<object>.Action.App);
|
||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
httpClient.Dispose();
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue(result != "[]");
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
using Expose.MyIT.Shared.Models.Stateless;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Serilog;
|
||||
using System.Net;
|
||||
|
||||
@ -8,10 +10,14 @@ namespace Expose.MyIT.Tests;
|
||||
public class UnitTestClientSettingsController
|
||||
{
|
||||
|
||||
private static ILogger? _Logger;
|
||||
private static string? _ControllerName;
|
||||
private static TestContext? _TestContext;
|
||||
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||
#pragma warning disable CS8618
|
||||
|
||||
private static ILogger _Logger;
|
||||
private static string _ControllerName;
|
||||
private static TestContext _TestContext;
|
||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
||||
|
||||
#pragma warning restore
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitAsync(TestContext testContext)
|
||||
@ -25,34 +31,61 @@ public class UnitTestClientSettingsController
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
_Logger.Information("Starting Web Application");
|
||||
Assert.AreEqual(Shared.Models.Stateless.Methods.IClientSettingsController.GetRouteName(), _ControllerName);
|
||||
Assert.AreEqual(IClientSettingsController<object>.GetRouteName(), _ControllerName);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task Get_ShouldReturn()
|
||||
public void GetClientSettings()
|
||||
{
|
||||
_Logger.Information("Starting Web Application");
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
IClientSettingsRepository clientSettingsRepository = serviceProvider.GetRequiredService<IClientSettingsRepository>();
|
||||
List<string> clientSettings = clientSettingsRepository.GetClientSettings(null);
|
||||
Assert.IsTrue(clientSettings is not null);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetClientSettingsApi()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}");
|
||||
string actionName = nameof(IClientSettingsController<object>.Action.Client);
|
||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
Assert.IsNotNull(result);
|
||||
httpClient.Dispose();
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue(result != "[]");
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetIpAddress()
|
||||
{
|
||||
_Logger.Information("Starting Web Application");
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
IClientSettingsRepository clientSettingsRepository = serviceProvider.GetRequiredService<IClientSettingsRepository>();
|
||||
string? ipAddress = clientSettingsRepository.GetIpAddress(null);
|
||||
Assert.IsTrue(ipAddress is not null);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetIpAddressApi()
|
||||
{
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string actionName = nameof(IClientSettingsController<object>.Action.IP);
|
||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
httpClient.Dispose();
|
||||
Assert.IsNotNull(result);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Expose.MyIT.Shared.Models.Methods;
|
||||
using Expose.MyIT.Shared.Models.Stateless.Methods;
|
||||
using Expose.MyIT.Shared.Models.Stateless;
|
||||
using Expose.MyIT.Shared.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -9,13 +8,17 @@ using System.Net;
|
||||
namespace Expose.MyIT.Tests;
|
||||
|
||||
[TestClass]
|
||||
public class UnitTestServiceShopOrderController : IServiceShopOrder
|
||||
public class UnitTestServiceShopOrderController
|
||||
{
|
||||
|
||||
private static ILogger? _Logger;
|
||||
private static string? _ControllerName;
|
||||
private static TestContext? _TestContext;
|
||||
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||
#pragma warning disable CS8618
|
||||
|
||||
private static ILogger _Logger;
|
||||
private static string _ControllerName;
|
||||
private static TestContext _TestContext;
|
||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
||||
|
||||
#pragma warning restore
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitAsync(TestContext testContext)
|
||||
@ -29,67 +32,49 @@ public class UnitTestServiceShopOrderController : IServiceShopOrder
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
_Logger.Information("Starting Web Application");
|
||||
Assert.AreEqual(IServiceShopOrderController.GetRouteName(), _ControllerName);
|
||||
Assert.AreEqual(IServiceShopOrderController<string>.GetRouteName(), _ControllerName);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestStatic_GetServiceShopOrders()
|
||||
public void GetServiceShopOrders()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
IServiceShopOrder serviceShopOrder = this;
|
||||
ServiceShopOrder[] serviceShopOrders = serviceShopOrder.TestStatic_GetServiceShopOrders(null);
|
||||
ServiceShopOrder[] serviceShopOrders = IServiceShopOrder.GetServiceShopOrders(null);
|
||||
Assert.IsNotNull(serviceShopOrders);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetAllServiceShopOrders_ShouldReturn()
|
||||
public async Task GetAllServiceShopOrders()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
_Logger.Information("Starting Web Application");
|
||||
ServiceShopOrder[] serviceShopOrders;
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
IServiceShopOrderRepository ServiceShopOrderRepository = serviceProvider.GetRequiredService<IServiceShopOrderRepository>();
|
||||
serviceShopOrders = await ServiceShopOrderRepository.GetAllServiceShopOrders();
|
||||
IServiceShopOrderRepository serviceShopOrderRepository = serviceProvider.GetRequiredService<IServiceShopOrderRepository>();
|
||||
serviceShopOrders = await serviceShopOrderRepository.GetAllServiceShopOrders();
|
||||
Assert.IsTrue(serviceShopOrders is not null);
|
||||
serviceShopOrders = await ServiceShopOrderRepository.GetServiceShopOrders("23188d3d-9b75-ed11-ab8b-0050568f2fc3");
|
||||
serviceShopOrders = await serviceShopOrderRepository.GetServiceShopOrders("23188d3d-9b75-ed11-ab8b-0050568f2fc3");
|
||||
Assert.IsTrue(serviceShopOrders is not null && serviceShopOrders.Any());
|
||||
Assert.IsNotNull(serviceShopOrders[0].ToString());
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetAllServiceShopOrders_API_ShouldReturn()
|
||||
public async Task GetAllServiceShopOrdersApi()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string actionName = nameof(Server.Controllers.ServiceShopOrderController.GetAllServiceShopOrders)[3..];
|
||||
string actionName = nameof(IServiceShopOrderController<object>.Action.All);
|
||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
Assert.IsNotNull(result);
|
||||
httpClient.Dispose();
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue(result != "[]");
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Expose.MyIT.Shared.Models.Methods;
|
||||
using Expose.MyIT.Shared.Models.Stateless.Methods;
|
||||
using Expose.MyIT.Shared.Models.Stateless;
|
||||
using Expose.MyIT.Shared.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -9,13 +8,17 @@ using System.Net;
|
||||
namespace Expose.MyIT.Tests;
|
||||
|
||||
[TestClass]
|
||||
public class UnitTestSsaOrderController : ISsaOrder
|
||||
public class UnitTestSsaOrderController
|
||||
{
|
||||
|
||||
private static ILogger? _Logger;
|
||||
private static string? _ControllerName;
|
||||
private static TestContext? _TestContext;
|
||||
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||
#pragma warning disable CS8618
|
||||
|
||||
private static ILogger _Logger;
|
||||
private static string _ControllerName;
|
||||
private static TestContext _TestContext;
|
||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
||||
|
||||
#pragma warning restore
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitAsync(TestContext testContext)
|
||||
@ -29,67 +32,49 @@ public class UnitTestSsaOrderController : ISsaOrder
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
_Logger.Information("Starting Web Application");
|
||||
Assert.AreEqual(ISsaOrderController.GetRouteName(), _ControllerName);
|
||||
Assert.AreEqual(ISsaOrderController<string>.GetRouteName(), _ControllerName);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestStatic_GetSsaOrders()
|
||||
public void GetSsaOrders()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
ISsaOrder ssaOrder = this;
|
||||
SsaOrder[] ssaOrders = ssaOrder.TestStatic_GetSsaOrders(null);
|
||||
SsaOrder[] ssaOrders = ISsaOrder.GetSsaOrders(null);
|
||||
Assert.IsNotNull(ssaOrders);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetAllSsaOrders_ShouldReturn()
|
||||
public async Task GetAllSsaOrders()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
_Logger.Information("Starting Web Application");
|
||||
SsaOrder[] ssaOrders;
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
ISsaOrderRepository SsaOrderRepository = serviceProvider.GetRequiredService<ISsaOrderRepository>();
|
||||
ssaOrders = await SsaOrderRepository.GetAllSsaOrders();
|
||||
ISsaOrderRepository ssaOrderRepository = serviceProvider.GetRequiredService<ISsaOrderRepository>();
|
||||
ssaOrders = await ssaOrderRepository.GetAllSsaOrders();
|
||||
Assert.IsTrue(ssaOrders is not null);
|
||||
ssaOrders = await SsaOrderRepository.GetSsaOrders("f0998fc8-c724-ed11-a98b-0050568f497f");
|
||||
ssaOrders = await ssaOrderRepository.GetSsaOrders("f0998fc8-c724-ed11-a98b-0050568f497f");
|
||||
Assert.IsTrue(ssaOrders is not null && ssaOrders.Any());
|
||||
Assert.IsNotNull(ssaOrders[0].ToString());
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetAllSsaOrders_API_ShouldReturn()
|
||||
public async Task GetAllSsaOrdersApi()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string actionName = nameof(Server.Controllers.SsaOrderController.GetAllSsaOrders)[3..];
|
||||
string actionName = nameof(ISsaOrderController<object>.Action.All);
|
||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
Assert.IsNotNull(result);
|
||||
httpClient.Dispose();
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue(result != "[]");
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,14 @@ namespace Expose.MyIT.Tests;
|
||||
public class UnitTestWeatherForecastController
|
||||
{
|
||||
|
||||
private static ILogger? _Logger;
|
||||
private static string? _ControllerName;
|
||||
private static TestContext? _TestContext;
|
||||
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||
#pragma warning disable CS8618
|
||||
|
||||
private static ILogger _Logger;
|
||||
private static string _ControllerName;
|
||||
private static TestContext _TestContext;
|
||||
private static WebApplicationFactory<Server.Program> _WebApplicationFactory;
|
||||
|
||||
#pragma warning restore
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitAsync(TestContext testContext)
|
||||
@ -25,26 +29,14 @@ public class UnitTestWeatherForecastController
|
||||
[TestMethod]
|
||||
public void TestControllerName()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
_Logger.Information("Starting Web Application");
|
||||
Assert.AreEqual(Shared.Models.Stateless.Methods.IWeatherForecastController.GetRouteName(), _ControllerName);
|
||||
Assert.AreEqual(Shared.Models.Stateless.IWeatherForecastController<object>.GetRouteName(), _ControllerName);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetReactors_ShouldReturnAllWeatherForecast()
|
||||
{
|
||||
if (_Logger is null)
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
if (_ControllerName is null)
|
||||
throw new NullReferenceException(nameof(_ControllerName));
|
||||
if (_WebApplicationFactory is null)
|
||||
throw new NullReferenceException(nameof(_WebApplicationFactory));
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}");
|
||||
|
Reference in New Issue
Block a user