From 6cb2f02f09cb0044f26d1744704203588ffbbeee Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 28 Aug 2024 15:34:31 -0700 Subject: [PATCH] muted warnings in Process, cleaned up Process test --- .../Consequences/NSIStreamingProcessor.cs | 16 ++++++++++++++-- ConsequencesTest/NSIStreamingProcessorTest.cs | 9 ++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Consequences/Consequences/NSIStreamingProcessor.cs b/Consequences/Consequences/NSIStreamingProcessor.cs index d9ac455..c287d6a 100644 --- a/Consequences/Consequences/NSIStreamingProcessor.cs +++ b/Consequences/Consequences/NSIStreamingProcessor.cs @@ -13,7 +13,7 @@ public async Task Process(BoundingBox boundingBox, Action private static string ConstructURL(BoundingBox boundingBox, string directive) { - StringBuilder url = new StringBuilder(); + StringBuilder url = new(); url.Append("https://nsi.sec.usace.army.mil/nsiapi/structures?bbox="); url.Append(boundingBox.NSIFormat()); @@ -31,7 +31,7 @@ private static async Task ProcessCollection(BoundingBox boundingBox, Action(propertiesElement.GetRawText()); + #pragma warning restore IL2026 + #pragma warning restore IL3050 // apply the action to the deserialized structure ConsequenceReceptorProcess(s); @@ -75,7 +81,13 @@ private static async Task ProcessStream(BoundingBox boundingBox, Action(propertiesElement.GetRawText()); + #pragma warning restore IL2026 + #pragma warning restore IL3050 // apply the action to the deserialized structure ConsequenceReceptorProcess(s); diff --git a/ConsequencesTest/NSIStreamingProcessorTest.cs b/ConsequencesTest/NSIStreamingProcessorTest.cs index ce319b0..0e29897 100644 --- a/ConsequencesTest/NSIStreamingProcessorTest.cs +++ b/ConsequencesTest/NSIStreamingProcessorTest.cs @@ -1,5 +1,6 @@ using System.Text.Json; using USACE.HEC.Consequences; +using USACE.HEC.Geography; using USACE.HEC.Hazards; using USACE.HEC.Results; @@ -8,14 +9,16 @@ namespace ConsequencesTest; public class NSIStreamingProcessorTest { [Fact] - public void Test() + public async Task Test() { IBBoxStreamingProcessor sp = new NSIStreamingProcessor(); - // int i = 0; IHazardProvider depthHazardProvider = new RandomDepthHazardProvider(25); + Location upperLeft1 = new Location { X = -122.475275, Y = 37.752394 }; + Location lowerRight1 = new Location { X = -122.473523, Y = 37.750642 }; + depthHazardProvider.Extent = new BoundingBox(upperLeft1, lowerRight1); IResultsWriter consoleWriter = new ConsoleWriter(); - sp.Process(depthHazardProvider.Extent, (IConsequencesReceptor s) => { + await sp.Process(depthHazardProvider.Extent, (IConsequencesReceptor s) => { Result r = s.Compute(depthHazardProvider.Hazard(s.GetLocation())); consoleWriter.Write(r); });