Dynamic 5 and 14 point copy
AppSettings alignment with other projects _TestContextTestName over _TestContext
This commit is contained in:
@ -14,7 +14,7 @@ public class UnitTestServiceShopOrderController
|
||||
|
||||
private static ILogger? _Logger;
|
||||
private static string _ControllerName;
|
||||
private static TestContext _TestContext;
|
||||
private static string? _TestContextTestName;
|
||||
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
|
||||
|
||||
#pragma warning restore
|
||||
@ -22,7 +22,7 @@ public class UnitTestServiceShopOrderController
|
||||
[ClassInitialize]
|
||||
public static void ClassInitAsync(TestContext testContext)
|
||||
{
|
||||
_TestContext = testContext;
|
||||
_TestContextTestName = testContext.TestName;
|
||||
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
|
||||
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
||||
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
|
||||
@ -34,7 +34,7 @@ public class UnitTestServiceShopOrderController
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.AreEqual(IServiceShopOrderController<string>.GetRouteName(), _ControllerName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -44,7 +44,7 @@ public class UnitTestServiceShopOrderController
|
||||
throw new NullReferenceException(nameof(_Logger));
|
||||
ServiceShopOrder[] serviceShopOrders = IServiceShopOrder.GetServiceShopOrders(null);
|
||||
Assert.IsNotNull(serviceShopOrders);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -60,7 +60,7 @@ public class UnitTestServiceShopOrderController
|
||||
serviceShopOrders = await serviceShopOrderRepository.GetServiceShopOrders("23188d3d-9b75-ed11-ab8b-0050568f2fc3");
|
||||
Assert.IsTrue(serviceShopOrders is not null && serviceShopOrders.Length != 0);
|
||||
Assert.IsNotNull(serviceShopOrders[0].ToString());
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -75,7 +75,7 @@ public class UnitTestServiceShopOrderController
|
||||
ServiceShopOrder[]? serviceShopOrders = System.Text.Json.JsonSerializer.Deserialize<ServiceShopOrder[]>(json);
|
||||
Assert.IsNotNull(serviceShopOrders);
|
||||
Assert.IsTrue(serviceShopOrders.Length != 0);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user