Removed more not needed properties from api

This commit is contained in:
2023-08-03 13:53:02 -07:00
parent c5e3acc3e4
commit ae47e7dbd5
4 changed files with 60 additions and 32 deletions

View File

@ -47,7 +47,7 @@ public class API : LoggingUnitTesting, IDisposable
catch (Exception) { }
}
#if (!true)
#if true
[Ignore]
#endif
[TestMethod]
@ -55,38 +55,68 @@ public class API : LoggingUnitTesting, IDisposable
{
MethodBase methodBase = new StackFrame().GetMethod();
#nullable enable
int[] runDataSheets = new int[]
{
504162,
601132,
602591,
602705,
601247,
602092,
603002,
602666,
602804,
602598,
601939
};
string url;
string json;
int failures = 0;
string httpClientResult;
HttpClient httpClient = new();
// string rds = "504162";
string rds = "601132";
string url = $"{FileRead.OpenInsightApplicationProgrammingInterface}/materials/rds/{rds}";
string httpClientResult = httpClient.GetStringAsync(url).Result;
FileHandlers.MoveAllFiles.OpenInsight.Root? root = JsonSerializer.Deserialize<FileHandlers.MoveAllFiles.OpenInsight.Root>(httpClientResult);
httpClient.Dispose();
Assert.IsNotNull(root?.Rds.ProdSpec.PrsStages);
FileHandlers.MoveAllFiles.OpenInsight.Root? root;
List<FileHandlers.MoveAllFiles.OpenInsight.QaMetTest>? collection;
Dictionary<string, List<FileHandlers.MoveAllFiles.OpenInsight.QaMetTest>> qaMetTests = new();
foreach (FileHandlers.MoveAllFiles.OpenInsight.PrsStage prsStage in root.Rds.ProdSpec.PrsStages)
foreach (int runDataSheet in runDataSheets)
{
if (prsStage.QaMetTests is null)
continue;
foreach (FileHandlers.MoveAllFiles.OpenInsight.QaMetTest qaMetTest in prsStage.QaMetTests)
url = $"{FileRead.OpenInsightApplicationProgrammingInterface}/materials/rds/{runDataSheet}";
httpClientResult = httpClient.GetStringAsync(url).Result;
try
{ root = JsonSerializer.Deserialize<FileHandlers.MoveAllFiles.OpenInsight.Root>(httpClientResult); }
catch (Exception)
{
if (qaMetTest.ToolClass != "FTIR")
continue;
if (!qaMetTests.TryGetValue(prsStage.Stage, out collection))
{
qaMetTests.Add(prsStage.Stage, new());
if (!qaMetTests.TryGetValue(prsStage.Stage, out collection))
throw new Exception();
}
collection.Add(qaMetTest);
root = null;
failures += 1;
System.IO.File.WriteAllText($"D:/{runDataSheet}.json", httpClientResult);
}
if (root is null)
continue;
Assert.IsNotNull(root?.Rds.ProdSpec.PrsStages);
foreach (FileHandlers.MoveAllFiles.OpenInsight.PrsStage prsStage in root.Rds.ProdSpec.PrsStages)
{
if (prsStage.QaMetTests is null)
continue;
foreach (FileHandlers.MoveAllFiles.OpenInsight.QaMetTest qaMetTest in prsStage.QaMetTests)
{
if (qaMetTest.ToolClass != "FTIR")
continue;
if (!qaMetTests.TryGetValue(prsStage.Stage, out collection))
{
qaMetTests.Add(prsStage.Stage, new());
if (!qaMetTests.TryGetValue(prsStage.Stage, out collection))
throw new Exception();
}
collection.Add(qaMetTest);
}
}
Assert.IsTrue(qaMetTests.Count > 0);
}
Assert.IsTrue(qaMetTests.Count > 0);
string json = JsonSerializer.Serialize(qaMetTests, new JsonSerializerOptions { WriteIndented = true });
httpClient.Dispose();
json = JsonSerializer.Serialize(qaMetTests, new JsonSerializerOptions { WriteIndented = true });
Assert.IsTrue(!string.IsNullOrEmpty(json));
System.IO.File.WriteAllText("D:/.json", json);
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase?.Name, " - Exit"));
Assert.IsTrue(failures == 0);
NonThrowTryCatch();
#nullable restore
}