MET08THFTIRSTRATUS - v2.43.4 - Builtin MonA, Run with layer and

1T
This commit is contained in:
2022-09-13 08:58:25 -07:00
parent 081513e457
commit 8e16a0bae9
42 changed files with 1493 additions and 388 deletions

View File

@ -13,9 +13,13 @@ namespace Adaptation._Tests.Shared;
public class UnitTesting
{
protected readonly bool _HasWaitForProperty;
protected readonly IsEnvironment _IsEnvironment;
protected readonly string _TestContextPropertiesAsJson;
public IsEnvironment IsEnvironment => _IsEnvironment;
public bool HasWaitForProperty => _HasWaitForProperty;
public string TestContextPropertiesAsJson => _TestContextPropertiesAsJson;
public UnitTesting(TestContext testContext, Type declaringType)
{
@ -23,18 +27,23 @@ public class UnitTesting
_IsEnvironment = null;
else
{
string waitFor = "\"WaitFor\":";
string projectDirectory = GetProjectDirectory(testContext);
string json = JsonSerializer.Serialize(testContext.Properties);
_TestContextPropertiesAsJson = JsonSerializer.Serialize(testContext.Properties, new JsonSerializerOptions { WriteIndented = true });
_HasWaitForProperty = _TestContextPropertiesAsJson.Contains(waitFor);
string vsCodeDirectory = Path.Combine(projectDirectory, ".vscode");
if (!Directory.Exists(vsCodeDirectory))
_ = Directory.CreateDirectory(vsCodeDirectory);
string launchText = GetLaunchText();
File.WriteAllText(Path.Combine(vsCodeDirectory, "launch.json"), launchText);
for (int i = 0; i < int.MaxValue; i++)
if (_HasWaitForProperty)
{
if (!json.Contains("Debugger.IsAttached") || Debugger.IsAttached)
break;
Thread.Sleep(500);
for (int i = 0; i < int.MaxValue; i++)
{
if (!_TestContextPropertiesAsJson.Contains($"{waitFor} \"Debugger.IsAttached\"") || Debugger.IsAttached)
break;
Thread.Sleep(500);
}
}
MethodBase methodBase = declaringType.GetMethod(testContext.TestName);
if (methodBase is not null)