Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.0 Deployment #240

Merged
merged 63 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
250db0f
Upgrade AssemblyFileVersion to 7.0.0.0
BHoMBot Sep 25, 2023
7a1e037
Update AssemblyFileVersion to 7.0 (#229)
Sep 25, 2023
b5b9b17
Refactor adapter to use configs instead of settings
Oct 10, 2023
1d5e1fa
Add Versioning
Oct 10, 2023
3e383dc
#220 handle users sending wrong objects
Oct 10, 2023
52e3221
Update versioning number
Oct 10, 2023
2f80de8
Update copyright and project compliance
Oct 10, 2023
9768649
Add property versioning
Oct 10, 2023
c7f0fa2
Update versioning, again
Oct 10, 2023
9dfc1d2
Update versioning again
Oct 10, 2023
52812a4
Update versioning again again again
Oct 10, 2023
3e45d8d
Final versioning update
Oct 10, 2023
aaf9375
Refactor to use ActionConfig instead of Settings (#230)
Oct 10, 2023
4f32b5c
pull tests created using model from IES testing procedure
Tom-Kingstone Oct 18, 2023
c1b1a6f
added todo notes for pulling in line with current test procedure
Tom-Kingstone Oct 18, 2023
af8d601
need review of gem model, also added testing shade pulls and openings
Tom-Kingstone Oct 19, 2023
728c612
added some comments
Tom-Kingstone Oct 19, 2023
b612a17
fixed gem files and added some more tests
Tom-Kingstone Oct 19, 2023
98f02b9
updated 2D shades model and tests, and added json source for the gem …
Tom-Kingstone Oct 20, 2023
d9dee09
fixed shades not pulling openings
Tom-Kingstone Oct 20, 2023
db25d5e
removed todos
Tom-Kingstone Oct 20, 2023
ce87c96
tests for pushing added
Tom-Kingstone Oct 20, 2023
aab923b
random creation of panels
Tom-Kingstone Oct 20, 2023
91d1f08
Revert "random creation of panels"
Tom-Kingstone Oct 23, 2023
80dd151
Revert "tests for pushing added"
Tom-Kingstone Oct 23, 2023
82838e6
Fix shades not pulling openings (#233)
Oct 23, 2023
80beb63
removed comment on L140
Tom-Kingstone Oct 23, 2023
a64891e
fixed references to ProgramData
Tom-Kingstone Oct 23, 2023
863b803
fixed references again
Tom-Kingstone Oct 23, 2023
8e1632b
Removed comment (#235)
Oct 23, 2023
8d1c9ba
removed global usings and removed spurious comments
Tom-Kingstone Oct 23, 2023
2d11d94
hopefully fixed proj compliance and copyright
Tom-Kingstone Oct 24, 2023
6b1e5a2
pull tests created using model from IES testing procedure
Tom-Kingstone Oct 18, 2023
ca945f9
added todo notes for pulling in line with current test procedure
Tom-Kingstone Oct 18, 2023
0c22467
need review of gem model, also added testing shade pulls and openings
Tom-Kingstone Oct 19, 2023
b6c645b
added some comments
Tom-Kingstone Oct 19, 2023
fa104b4
fixed gem files and added some more tests
Tom-Kingstone Oct 19, 2023
de481fe
updated 2D shades model and tests, and added json source for the gem …
Tom-Kingstone Oct 20, 2023
df717eb
removed todos
Tom-Kingstone Oct 20, 2023
4dc597b
tests for pushing added
Tom-Kingstone Oct 20, 2023
383cf08
random creation of panels
Tom-Kingstone Oct 20, 2023
bf60d22
Revert "random creation of panels"
Tom-Kingstone Oct 23, 2023
5cd2cd4
Revert "tests for pushing added"
Tom-Kingstone Oct 23, 2023
850814b
fixed references to ProgramData
Tom-Kingstone Oct 23, 2023
b595a98
fixed references again
Tom-Kingstone Oct 23, 2023
9fe10c6
removed global usings and removed spurious comments
Tom-Kingstone Oct 23, 2023
b058730
hopefully fixed proj compliance and copyright
Tom-Kingstone Oct 24, 2023
9f8566f
Merge branch 'IES_Toolkit-#231-NUnitTestsPull' of https://github.com/…
Tom-Kingstone Oct 24, 2023
12ff752
Functional tests for pulling panels and spaces (#237)
Oct 24, 2023
7fdf031
initial push test commit
Tom-Kingstone Oct 24, 2023
8b43b38
initial push test commit
Tom-Kingstone Oct 24, 2023
1207a36
updated tests to check that the pulled panels are identical to the pu…
Tom-Kingstone Oct 24, 2023
96d0902
Merge branch 'IES_Toolkit-#236-NUnitTestsPush' of https://github.com/…
Tom-Kingstone Oct 24, 2023
1ecec38
fixed weird merge
Tom-Kingstone Oct 24, 2023
d965a55
removed unnecessary linq statements
Tom-Kingstone Oct 25, 2023
9eda121
added comment explaining spaces pull
Tom-Kingstone Oct 25, 2023
2a49174
added comments describing process
Tom-Kingstone Oct 25, 2023
6880b44
fixed proj refs
Tom-Kingstone Oct 25, 2023
03ce9a0
added check for if count of panels pulled are the same as count of pa…
Tom-Kingstone Oct 25, 2023
b46d8fb
Apply suggestions from code review
Tom-Kingstone Oct 25, 2023
a82146a
Functional tests for pushing panels (#238)
Oct 25, 2023
a155217
Update readme links and references
BHoMBot Nov 3, 2023
dc690f5
Update README links and references (#239)
Nov 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .ci/unit-tests/IES_Adapter_Test/IES_Adapter_Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<Description>https://github.com/BHoM/IES_Toolkit</Description>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Configurations>Debug;Release;Test</Configurations>
<Authors>BHoM</Authors>
<Copyright>Copyright © https://github.com/BHoM</Copyright>
<RootNamespace>BH.Tests.Adapter.IES</RootNamespace>
<FileVersion>7.0.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
<PackageReference Include="NUnit.Analyzers" Version="3.6.1" />
<PackageReference Include="coverlet.collector" Version="3.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\IES_Adapter\IES_Adapter.csproj" />
<ProjectReference Include="..\..\..\IES_Engine\IES_Engine.csproj" />
<ProjectReference Include="..\..\..\IES_oM\IES_oM.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Adapter_Engine">
<HintPath>$(ProgramData)\BHoM\Assemblies\Adapter_Engine.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Adapter_oM">
<HintPath>$(ProgramData)\BHoM\Assemblies\Adapter_oM.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BHoM">
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BHoM_Adapter">
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM_Adapter.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BHoM_Engine">
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM_Engine.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Data_Engine">
<HintPath>$(ProgramData)\BHoM\Assemblies\Data_Engine.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Data_oM">
<HintPath>$(ProgramData)\BHoM\Assemblies\Data_oM.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Environment_Engine">
<HintPath>$(ProgramData)\BHoM\Assemblies\Environment_Engine.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Environment_oM">
<HintPath>$(ProgramData)\BHoM\Assemblies\Environment_oM.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="File_Engine">
<HintPath>$(ProgramData)\BHoM\Assemblies\File_Engine.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="File_oM">
<HintPath>$(ProgramData)\BHoM\Assemblies\File_oM.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Geometry_oM">
<HintPath>$(ProgramData)\BHoM\Assemblies\Geometry_oM.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>

</Project>
297 changes: 297 additions & 0 deletions .ci/unit-tests/IES_Adapter_Test/PullTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2023, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using NUnit.Framework;
using BH.Adapter.IES;
using BH.oM.Adapter;
using BH.oM.Data.Requests;
using BH.oM.Environment.Elements;
using BH.oM.Environment.IES;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using BH.Engine.Environment;
using BH.oM.Base;

namespace BH.Tests.Adapter.IES
{
public class PullTests
{

IESAdapter m_Adapter;
PullConfigIES m_PullConfig;

[OneTimeSetUp]
[Description("On loading the tests, instantiate an adapter and pull config to be used in all tests, and get the file path to the models.")]
public void OneTimeSetUp()
{
//starts the IES adapter and instantiates the ActionConfig for pulling IES data.
string currentDirectory = AppDomain.CurrentDomain.BaseDirectory;
List<string> paths = currentDirectory.Split('\\').ToList();
paths = paths.Take(paths.IndexOf(".ci") + 2).ToList();
string ModelsPath = Path.Join(string.Join("\\", paths), "Models");
m_Adapter = new IESAdapter();
m_PullConfig = new PullConfigIES()
{
AngleTolerance = BH.oM.Geometry.Tolerance.Angle,
DistanceTolerance = BH.oM.Geometry.Tolerance.MacroDistance,
File = new FileSettings()
{
Directory = ModelsPath
},
};
}

[SetUp]
[Description("When running a new test, clear any errors and warnings that have occured in previous test.")]
public void Setup()
{
BH.Engine.Base.Compute.ClearCurrentEvents();
}

[TearDown]
[Description("If any events occurred during a test, log the types and messages of the event in the console so that it is easier to debug.")]
public void TearDown()
{
var events = BH.Engine.Base.Query.CurrentEvents();
if (events.Any())
{
Console.WriteLine("BHoM Events raised during execution:");
foreach (var ev in events)
{
Console.WriteLine($"{ev.Type}: {ev.Message}");
}
}
}

[Test]
[Description("Test pulling panels with openingsfrom a model with 3D shades.")]
public void PullPanelsWithOpenings3D()
{
//arrange request and pull config for pulling panels with openings
FilterRequest request = new FilterRequest() { Type = typeof(Panel) };
m_PullConfig.PullOpenings = true;
m_PullConfig.File.FileName = "IES Model 3D Shades.gem";
m_PullConfig.ShadesAs3D = true;

//pull all panels from the model, including openings.
List<Panel> panels = m_Adapter.Pull(request, actionConfig: m_PullConfig).Cast<Panel>().ToList();
//put all the panels that are shades into a list.
List<Panel> shades = new List<Panel>();
foreach (Panel panel in panels)
{
if (panel.IsShade())
{
shades.Add(panel);
}
}

//assert correct values.
panels.Count.Should().Be(121, "Wrong number of panels pulled compared to expected.");
panels.OpeningsFromElements().Count.Should().Be(33, "Wrong number of openings pulled compared to expected.");
shades.Count.Should().Be(62, "Wrong number of shades being pulled compared to expected.");
}

[Test]
[Description("Test pulling panels with openings from a model with 2D shades.")]
public void PullPanelsWithOpenings2D()
{
//arrange request and pull config for pulling panels with openings
FilterRequest request = new FilterRequest() { Type = typeof(Panel) };
m_PullConfig.PullOpenings = true;
m_PullConfig.File.FileName = "IES Model 2D Shades.gem";
m_PullConfig.ShadesAs3D = false;

//pull all panels from the model, including openings.
List<Panel> panels = m_Adapter.Pull(request, actionConfig: m_PullConfig).Cast<Panel>().ToList();
//put all the panels that are shades into a list.
List<Panel> shades = new List<Panel>();
foreach (Panel panel in panels)
{
if (panel.IsShade())
{
shades.Add(panel);
}
}

//assert correct values.
panels.Count.Should().Be(121, "Wrong number of panels pulled compared to expected.");
panels.OpeningsFromElements().Count.Should().Be(33, "Wrong number of openings pulled compared to expected.");
shades.Count.Should().Be(62, "Wrong number of shades being pulled compared to expected.");
}

[Test]
[Description("Test pulling spaces from a model with 3D shades.")]
public void PullSpaces3D()
{
//arrange request for pulling spaces.
FilterRequest request = new FilterRequest() { Type = typeof(Space) };
m_PullConfig.PullOpenings = true;
m_PullConfig.File.FileName = "IES Model 3D Shades.gem";
m_PullConfig.ShadesAs3D = true;

//pull all spaces from the model.
List<Space> spaces = m_Adapter.Pull(request, actionConfig: m_PullConfig).Cast<Space>().ToList();

//assert correct values.
spaces.Count.Should().Be(14, "Wrong number of panels pulled compared to expected.");
}

[Test]
[Description("Test pulling spaces from a model with 2D shades.")]
public void PullSpaces2D()
{
//arrange request for pulling spaces.
FilterRequest request = new FilterRequest() { Type = typeof(Space) };
m_PullConfig.PullOpenings = true;
m_PullConfig.File.FileName = "IES Model 2D Shades.gem";
m_PullConfig.ShadesAs3D = false;

//pull all spaces from the model.
List<Space> spaces = m_Adapter.Pull(request, actionConfig: m_PullConfig).Cast<Space>().ToList();

//assert correct values.
spaces.Count.Should().Be(9, "Wrong number of panels pulled compared to expected."); //number of spaces in 3D but there are no shade spaces (0 shade spaces rather than 5)
}

[Test]
[Description("Test pulling panels without openings from a model with 3D shades.")]
public void PullPanelsWithoutOpenings3D()
{
//arrange request and pull config for pulling panels without openings.
FilterRequest request = new FilterRequest() { Type = typeof(Panel) };
m_PullConfig.PullOpenings = false;
m_PullConfig.File.FileName = "IES Model 3D Shades.gem";
m_PullConfig.ShadesAs3D = true;

//pull all panels from the model, excluding openings.
List<Panel> panels = m_Adapter.Pull(request, actionConfig: m_PullConfig).Cast<Panel>().ToList();
//add all the panels that are shades to a list.
List<Panel> shades = new List<Panel>();
foreach (Panel panel in panels)
{
if (panel.IsShade())
{
shades.Add(panel);
}
}

//assert correct values.
panels.Count.Should().Be(121, "Wrong number of panels pulled compared to expected.");
panels.OpeningsFromElements().Count.Should().Be(0, "Wrong number of openings pulled compared to expected.");
shades.Count.Should().Be(62, "Wrong number of shades being pulled compared to expected.");
}

[Test]
[Description("Test pulling panels without openings from a model with 2D shades.")]
public void PullPanelsWithoutOpenings2D()
{
//arrange request and pull config for pulling panels without openings.
FilterRequest request = new FilterRequest() { Type = typeof(Panel) };
m_PullConfig.PullOpenings = false;
m_PullConfig.File.FileName = "IES Model 2D Shades.gem";
m_PullConfig.ShadesAs3D = false;

//pull all panels from the model, excluding openings.
List<Panel> panels = m_Adapter.Pull(request, actionConfig: m_PullConfig).Cast<Panel>().ToList();
//add all the panels that are shades to a list.
List<Panel> shades = new List<Panel>();
foreach (Panel panel in panels)
{
if (panel.IsShade())
{
shades.Add(panel);
}
}

//assert correct values.
panels.Count.Should().Be(121, "Wrong number of panels pulled compared to expected.");
panels.OpeningsFromElements().Count.Should().Be(0, "Wrong number of openings pulled compared to expected.");
shades.Count.Should().Be(62, "Wrong number of shades being pulled compared to expected.");
}

[Test]
[Description("Test pulling all data from a model with 3D shades.")]
public void PullFullModel3D()
{
FilterRequest request = new FilterRequest() { };
m_PullConfig.PullOpenings = true;
m_PullConfig.File.FileName = "IES Model 3D Shades.gem";
m_PullConfig.ShadesAs3D = true;

//pull all objects from the model, excluding openings.
List<IBHoMObject> objects = m_Adapter.Pull(request, actionConfig: m_PullConfig).Cast<IBHoMObject>().ToList();
//cast spaces and panels to lists
List<Space> spaces = BH.Engine.Environment.Query.Spaces(objects).Cast<Space>().ToList();
List<Panel> panels = BH.Engine.Environment.Query.Panels(objects).Cast<Panel>().ToList();
//add all the panels that are shades to a list.
List<Panel> shades = new List<Panel>();
foreach (Panel panel in panels)
{
if (panel.IsShade())
{
shades.Add(panel);
}
}

//assert correct values.
panels.Count.Should().Be(121, "Wrong number of panels pulled compared to expected.");
panels.OpeningsFromElements().Count.Should().Be(33, "Wrong number of openings pulled compared to expected.");
spaces.Count.Should().Be(14, "Wrong number of panels pulled compared to expected.");
shades.Count.Should().Be(62, "Wrong number of shades pulled compared to expected.");
}

[Test]
[Description("Test pulling all data from a model with 2D shades.")]
public void PullFullModel2D()
{
FilterRequest request = new FilterRequest() { };
m_PullConfig.PullOpenings = true;
m_PullConfig.File.FileName = "IES Model 2D Shades.gem";
m_PullConfig.ShadesAs3D = false;

//pull all objects from the model, excluding openings.
List<IBHoMObject> objects = m_Adapter.Pull(request, actionConfig: m_PullConfig).Cast<IBHoMObject>().ToList();
//cast spaces and panels to lists
List<Space> spaces = BH.Engine.Environment.Query.Spaces(objects).Cast<Space>().ToList();
List<Panel> panels = BH.Engine.Environment.Query.Panels(objects).Cast<Panel>().ToList();
//add all the panels that are shades to a list.
List<Panel> shades = new List<Panel>();
foreach (Panel panel in panels)
{
if (panel.IsShade())
{
shades.Add(panel);
}
}

//assert correct values.
panels.Count.Should().Be(121, "Wrong number of panels pulled compared to expected.");
panels.OpeningsFromElements().Count.Should().Be(33, "Wrong number of openings pulled compared to expected.");
spaces.Count.Should().Be(9, "Wrong number of panels pulled compared to expected.");
shades.Count.Should().Be(62, "Wrong number of shades pulled compared to expected.");
}
}
}
Loading