Dynamic 5 and 14 point copy

AppSettings alignment with other projects

_TestContextTestName over _TestContext
This commit is contained in:
2025-05-02 15:22:18 -07:00
parent 2afb312065
commit 6f52566fc2
30 changed files with 415 additions and 326 deletions

View File

@ -14,7 +14,7 @@ public class UnitTestInfinityQSV3Controller
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 UnitTestInfinityQSV3Controller
[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 UnitTestInfinityQSV3Controller
{
_Logger?.LogInformation("Starting Web Application");
Assert.AreEqual(IInfinityQSV3Controller<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -53,7 +53,7 @@ public class UnitTestInfinityQSV3Controller
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
string? result = infinityQSV3Repository?.GetCommandText("1698497987", "61", "CDE5", "5012", "575908", "");
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -66,7 +66,7 @@ public class UnitTestInfinityQSV3Controller
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/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();
}
@ -84,7 +84,7 @@ public class UnitTestInfinityQSV3Controller
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();
}
@ -99,7 +99,7 @@ public class UnitTestInfinityQSV3Controller
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
Result<InfinityQSV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV3[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -114,7 +114,7 @@ public class UnitTestInfinityQSV3Controller
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();
}
@ -129,7 +129,7 @@ public class UnitTestInfinityQSV3Controller
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
Result<InfinityQSDescriptorV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV3[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -142,7 +142,7 @@ public class UnitTestInfinityQSV3Controller
Result<InfinityQSV3[]>? result = infinityQSV3Repository?.GetHeader("1698497987");
Assert.IsNotNull(result?.Results);
Assert.IsNotNull(result?.Results[0].Part);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -157,7 +157,7 @@ public class UnitTestInfinityQSV3Controller
Result<InfinityQSV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV3[]>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsNotNull(result?.Results[0].Part);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -169,7 +169,7 @@ public class UnitTestInfinityQSV3Controller
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
string? result = infinityQSV3Repository?.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma("41", "8IN_THIN ROTR");
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -182,7 +182,7 @@ public class UnitTestInfinityQSV3Controller
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/41/product-data-average-sum-of-defects-process-mean-process-sigma?recipe=8IN_THIN ROTR");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProductDataAverageSumOfDefectsProcessMeanProcessSigma)}.json"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -195,7 +195,7 @@ public class UnitTestInfinityQSV3Controller
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
List<string[]>? results = infinityQSV3Repository?.GetEpiProTempVerificationRows(night);
Assert.IsNotNull(results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -208,7 +208,7 @@ public class UnitTestInfinityQSV3Controller
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/epi-pro-temp-verification-rows/?night=44&night=46&night=52&night=54");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerificationRows)}.json"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -221,7 +221,7 @@ public class UnitTestInfinityQSV3Controller
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
string? result = infinityQSV3Repository?.GetEpiProTempVerification(night);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}
@ -234,7 +234,7 @@ public class UnitTestInfinityQSV3Controller
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/epi-pro-temp-verification/?night=44&night=46&night=52&night=54");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerification)}.html"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
NonThrowTryCatch();
}