diff --git a/.ci/unit-tests/XML_Adapter_Tests/PushTests.cs b/.ci/unit-tests/XML_Adapter_Tests/PushTests.cs index 79d1f31..a0cc527 100644 --- a/.ci/unit-tests/XML_Adapter_Tests/PushTests.cs +++ b/.ci/unit-tests/XML_Adapter_Tests/PushTests.cs @@ -24,6 +24,7 @@ public class PushTests XMLAdapter m_adapter; XMLConfig m_config; List m_jsonObjects; + List m_jsonPanels; [OneTimeSetUp] public void OneTimeSetUp() @@ -38,6 +39,7 @@ public void OneTimeSetUp() File = new FileSettings() { Directory = ModelsPath, FileName = "PushedModel.xml"}, }; m_jsonObjects = BH.Engine.Adapters.File.Compute.ReadFromJsonFile(Path.Combine(ModelsPath, "TestModel.json"), true).Cast().ToList(); + m_jsonPanels = BH.Engine.Environment.Query.Panels(m_jsonObjects); } [SetUp] @@ -78,12 +80,11 @@ public void PushGBXML() List objs = m_adapter.Pull(request, actionConfig: m_config).Cast().ToList(); List pulledPanels = BH.Engine.Environment.Query.Panels(objs); - List jsonPanels = BH.Engine.Environment.Query.Panels(m_jsonObjects); List constructions = objs.Where(x => x.GetType() == typeof(Construction)).Cast().ToList(); List jsonConstructions = m_jsonObjects.Where(x => x.GetType() == typeof(Construction) && x.Name == "generic_construction").Cast().ToList(); pulledPanels = BH.Engine.Data.Query.OrderBy(pulledPanels, "Name"); - jsonPanels = BH.Engine.Data.Query.OrderBy(jsonPanels, "Name"); + List jsonPanels = BH.Engine.Data.Query.OrderBy(m_jsonPanels, "Name"); //assert correct values pulledPanels.Count.Should().Be(jsonPanels.Count, "There was a different number of panels pushed then pulled compared to expected."); @@ -114,11 +115,10 @@ public void PushGBXMLNoConstructions() List objs = m_adapter.Pull(request, actionConfig: m_config).Cast().ToList(); List pulledPanels = BH.Engine.Environment.Query.Panels(objs); - List jsonPanels = BH.Engine.Environment.Query.Panels(m_jsonObjects); List constructions = objs.Where(x => x.GetType() == typeof(Construction)).Cast().ToList(); pulledPanels = BH.Engine.Data.Query.OrderBy(pulledPanels, "Name"); - jsonPanels = BH.Engine.Data.Query.OrderBy(jsonPanels, "Name"); + List jsonPanels = BH.Engine.Data.Query.OrderBy(m_jsonPanels, "Name"); //assert correct values pulledPanels.Count.Should().Be(jsonPanels.Count, "There was a different number of panels pushed then pulled compared to expected."); @@ -144,16 +144,17 @@ public void PushGBXMLBuildingShell() }; FilterRequest request = new FilterRequest(); + //push, then pull objects m_adapter.Push(m_jsonObjects, actionConfig: m_config); List objs = m_adapter.Pull(request, actionConfig: m_config).Cast().ToList(); List pulledPanels = BH.Engine.Environment.Query.Panels(objs); - List jsonPanels = BH.Engine.Environment.Query.Panels(m_jsonObjects); //perhaps refactor to be m_jsonPanels List constructions = objs.Where(x => x.GetType() == typeof(Construction)).Cast().ToList(); pulledPanels = BH.Engine.Data.Query.OrderBy(pulledPanels, "Name"); - jsonPanels = BH.Engine.Data.Query.OrderBy(jsonPanels.ToSpaces().ExternalElements(), "Name"); + List jsonPanels = BH.Engine.Data.Query.OrderBy(m_jsonPanels.ToSpaces().ExternalElements(), "Name"); + //assert correct values pulledPanels.Count.Should().Be(jsonPanels.Count, "There was a different number of external panels pulled compared to expected."); for (int i = 0; i < jsonPanels.Count; i++) {