Skip to content

Commit

Permalink
Update Reflection -> Base on CI verification code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser Greenroyd committed Jun 17, 2022
1 parent a48099d commit f0a1c31
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .ci/code/UI_Test/Helpers/InstantiateCaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static Caller InstantiateCaller(SearchItem item)
}
catch (Exception e)
{
Engine.Reflection.Compute.RecordError($"Failed to instantiate {item.Text}.\nError: {e.Message}");
Engine.Base.Compute.RecordError($"Failed to instantiate {item.Text}.\nError: {e.Message}");
return null;
}
}
Expand All @@ -75,7 +75,7 @@ public static Caller InstantiateCaller(Type type)
}
catch (Exception e)
{
Engine.Reflection.Compute.RecordError($"Failed to instantiate {type.IToText()}.\nError: {e.Message}");
Engine.Base.Compute.RecordError($"Failed to instantiate {type.IToText()}.\nError: {e.Message}");
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion .ci/code/UI_Test/Helpers/PossibleComponentItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static partial class Helpers

public static List<SearchItem> PossibleComponentItems()
{
Engine.Reflection.Compute.LoadAllAssemblies();
Engine.Base.Compute.LoadAllAssemblies();
SearchMenu_WinForm searchMenu = new SearchMenu_WinForm();
return searchMenu.PossibleItems.Where(x => !(x.Item is string && (x.Item as string).StartsWith("TestSets"))).ToList();
}
Expand Down
2 changes: 1 addition & 1 deletion .ci/code/UI_Test/Objects/DummyAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

using BH.oM.Base;
using BH.oM.Reflection.Debugging;
using BH.oM.Base.Debugging;
using BH.oM.UI;
using System;
using System.Collections;
Expand Down
8 changes: 2 additions & 6 deletions .ci/code/UI_Test/UI_Test.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -47,10 +47,6 @@
<HintPath>C:\ProgramData\BHoM\Assemblies\Reflection_Engine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Reflection_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\Reflection_oM.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
Expand Down Expand Up @@ -92,4 +88,4 @@
<PropertyGroup>
<PostBuildEvent>xcopy "$(TargetDir)$(TargetFileName)" "C:\ProgramData\BHoM\Assemblies" /Y</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
6 changes: 3 additions & 3 deletions .ci/code/UI_Test/Verify/ComponentInstantiation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

using BH.Engine.Test;
using BH.oM.Reflection.Debugging;
using BH.oM.Base.Debugging;
using BH.oM.Test;
using BH.oM.Test.Results;
using BH.oM.UI;
Expand Down Expand Up @@ -68,15 +68,15 @@ public static TestResult ComponentInstantiation()

public static TestResult ComponentInstantiation(SearchItem item)
{
Engine.Reflection.Compute.ClearCurrentEvents();
Engine.Base.Compute.ClearCurrentEvents();
Caller caller = Helpers.InstantiateCaller(item);
if (caller == null)
return new TestResult
{
Description = item.Text,
Status = TestStatus.Error,
Message = $"Error: Failed to instatiate {item.Text}.",
Information = Engine.Reflection.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
Information = Engine.Base.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
};
else
return Engine.Test.Create.PassResult(item.Text);
Expand Down
17 changes: 8 additions & 9 deletions .ci/code/UI_Test/Verify/ComponentReadWriteCycle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

using BH.Engine.Test;
using BH.oM.Base;
using BH.oM.Reflection;
using BH.oM.Reflection.Debugging;
using BH.oM.Base.Debugging;
using BH.oM.Test;
using BH.oM.Test.Results;
using BH.oM.UI;
Expand Down Expand Up @@ -70,15 +69,15 @@ public static TestResult ComponentReadWriteCycle()

public static TestResult ComponentReadWriteCycle(SearchItem item)
{
Engine.Reflection.Compute.ClearCurrentEvents();
Engine.Base.Compute.ClearCurrentEvents();
Caller caller = Helpers.InstantiateCaller(item);
if (caller == null)
return new TestResult
{
Description = item.Text,
Status = TestStatus.Error,
Message = $"Error: Failed to instatiate {item.Text}.",
Information = Engine.Reflection.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
Information = Engine.Base.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
};

Caller copy = null;
Expand All @@ -90,13 +89,13 @@ public static TestResult ComponentReadWriteCycle(SearchItem item)
}
catch (Exception e)
{
Engine.Reflection.Compute.RecordError(e.Message);
Engine.Base.Compute.RecordError(e.Message);
return new TestResult
{
Description = item.Text,
Status = TestStatus.Error,
Message = $"Error: Failed to copy {item.Text}.",
Information = Engine.Reflection.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
Information = Engine.Base.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
};
}

Expand All @@ -113,18 +112,18 @@ public static TestResult ComponentReadWriteCycle(SearchItem item)
Description = item.Text,
Status = TestStatus.Error,
Message = $"Error: Incorrect copy of {item.Text}.",
Information = Engine.Reflection.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
Information = Engine.Base.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
};
}
catch (Exception e)
{
Engine.Reflection.Compute.RecordError(e.Message);
Engine.Base.Compute.RecordError(e.Message);
return new TestResult
{
Description = item.Text,
Status = TestStatus.Error,
Message = $"Error: Failed to test equality of {item.Text}.",
Information = Engine.Reflection.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
Information = Engine.Base.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
};
}
}
Expand Down
18 changes: 9 additions & 9 deletions .ci/code/UI_Test/Verify/ComponentRunCycle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

using BH.Engine.Test;
using BH.oM.Reflection.Debugging;
using BH.oM.Base.Debugging;
using BH.oM.Test;
using BH.oM.Test.Results;
using BH.oM.UI;
Expand Down Expand Up @@ -69,15 +69,15 @@ public static TestResult ComponentRunCycle()

public static TestResult ComponentRunCycle(SearchItem item)
{
Engine.Reflection.Compute.ClearCurrentEvents();
Engine.Base.Compute.ClearCurrentEvents();
Caller caller = Helpers.InstantiateCaller(item);
if (caller == null)
return new TestResult
{
Description = item.Text,
Status = TestStatus.Error,
Message = $"Error: Failed to instatiate {item.Text}.",
Information = Engine.Reflection.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
Information = Engine.Base.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
};

if (caller is MultiChoiceCaller)
Expand All @@ -91,13 +91,13 @@ public static TestResult ComponentRunCycle(SearchItem item)
}
catch (Exception e)
{
Engine.Reflection.Compute.RecordError(e.Message);
Engine.Base.Compute.RecordError(e.Message);
return new TestResult
{
Description = item.Text,
Status = TestStatus.Error,
Message = $"Error: Failed to create dummy caller for {item.Text}.",
Information = Engine.Reflection.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
Information = Engine.Base.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
};
}

Expand All @@ -108,27 +108,27 @@ public static TestResult ComponentRunCycle(SearchItem item)
caller.SetDataAccessor(m_Accessor);
dummy.Run();

List<Event> errors = BH.Engine.Reflection.Query.CurrentEvents().Where(x => x.Type == EventType.Error).ToList();
List<Event> errors = BH.Engine.Base.Query.CurrentEvents().Where(x => x.Type == EventType.Error).ToList();
if (errors.Count > 0 || m_Accessor.Outputs.Any(x => x == null))
return new TestResult
{
Description = item.Text,
Status = TestStatus.Error,
Message = $"Error: Failed to handle params of {item.Text}.",
Information = Engine.Reflection.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
Information = Engine.Base.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
};
else
return Engine.Test.Create.PassResult("item.Text");
}
catch (Exception e)
{
Engine.Reflection.Compute.RecordError(e.Message);
Engine.Base.Compute.RecordError(e.Message);
return new TestResult
{
Description = item.Text,
Status = TestStatus.Error,
Message = $"Error: Failed to test param handling of {item.Text}.",
Information = Engine.Reflection.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
Information = Engine.Base.Query.CurrentEvents().Select(x => x.ToEventMessage()).ToList<ITestInformation>()
};
}
}
Expand Down

0 comments on commit f0a1c31

Please sign in to comment.