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 UnitTestInfinityQSV2Controller
|
||||
|
||||
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 UnitTestInfinityQSV2Controller
|
||||
[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>>();
|
||||
@ -41,7 +41,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.AreEqual(IInfinityQSV2Controller<string>.GetRouteName(), _ControllerName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>();
|
||||
string? result = infinityQSV2Repository?.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/commandText/?process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
|
||||
Assert.IsNotNull(json);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
||||
Assert.IsNotNull(result?.Results[0].VariableNumber);
|
||||
Assert.IsNotNull(result?.Results[0].SubGroupDateTime);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
|
||||
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
Assert.IsTrue(result?.Results.Length != 0);
|
||||
Assert.IsNotNull(result?.Results[0].SubGroupId);
|
||||
Assert.IsNotNull(result?.Results[0].SiteNumber);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
|
||||
Result<InfinityQSDescriptorV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV2[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>();
|
||||
Result<InfinityQSEventV2[]>? result = infinityQSV2Repository?.GetEvents("1677273357");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json);
|
||||
Result<InfinityQSEventV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEventV2[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
Result<InfinityQSBaseV2[]>? result = infinityQSV2Repository?.GetHeader("1677273357");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsNotNull(result?.Results[0].Part);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ public class UnitTestInfinityQSV2Controller
|
||||
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsNotNull(result?.Results[0].Part);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user