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 UnitTestInfinityQSController
|
||||
|
||||
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 UnitTestInfinityQSController
|
||||
[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 UnitTestInfinityQSController
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class UnitTestInfinityQSController
|
||||
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||
string? result = infinityQSRepository?.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ public class UnitTestInfinityQSController
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/commandText/?sub_group_id=1677273357&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();
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ public class UnitTestInfinityQSController
|
||||
Assert.IsNotNull(result?.Results[0].SE_TSNO);
|
||||
Assert.IsNotNull(result?.Results[0].TD_NAME);
|
||||
Assert.IsNotNull(result?.Results[0].TD_TEST);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ public class UnitTestInfinityQSController
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json);
|
||||
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ public class UnitTestInfinityQSController
|
||||
Assert.IsTrue(result?.Results.Length != 0);
|
||||
Assert.IsNotNull(result?.Results[0].SD_SGRP);
|
||||
Assert.IsNotNull(result?.Results[0].SD_TSNO);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ public class UnitTestInfinityQSController
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json);
|
||||
Result<InfinityQSDescriptor[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptor[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ public class UnitTestInfinityQSController
|
||||
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||
Result<InfinityQSEvent[]>? result = infinityQSRepository?.GetEvents("1677273357");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ public class UnitTestInfinityQSController
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json);
|
||||
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ public class UnitTestInfinityQSController
|
||||
IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>();
|
||||
Result<InfinityQSBase[]>? result = infinityQSRepository?.GetHeader("1677273357");
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ public class UnitTestInfinityQSController
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json);
|
||||
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContextTestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user