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

Serialiser_Engine: Various changes to get unit-tests functional #3391

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0 +0,0 @@
{ "_t" : "BH.oM.Data.Library.Dataset", "SourceInformation" : { "_t" : "BH.oM.Data.Library.Source", "SourceLink" : "", "Title" : "DocumentationURL", "Author" : "FGreenroyd", "ItemReference" : "", "Version" : "", "Publisher" : "", "Schema" : "", "Language" : "", "Location" : "", "Copyright" : "", "Contributors" : "", "Confidence" : "Low", "BHoM_Guid" : "160b3450-595b-461d-a76d-54c4358f0534", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { } }, "TimeOfCreation" : { "$date" : 1686063438863 }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.UnitTest", "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Reflection.Query, Reflection_Engine, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"6.2\" }", "MethodName" : "DocumentationURL", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Reflection.MemberInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"6.2\" }"], "_bhomVersion" : "6.2" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [{ "_t" : "System.Type", "Name" : "BH.oM.Structure.Elements.Bar", "_bhomVersion" : "6.2" }], "Outputs" : [{ "_t" : "System.Collections.Generic.List`1[[BH.oM.Base.Attributes.DocumentationURLAttribute, BHoM, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null]]", "_v" : [{ "_t" : "BH.oM.Base.Attributes.DocumentationURLAttribute", "DocumentationURL" : "https://bhom.xyz/documentation/Conventions/BHoM-Structural-Conventions/", "Type" : "Documentation", "Description" : "", "TypeId" : { "_t" : "System.Type", "Name" : "BH.oM.Base.Attributes.DocumentationURLAttribute", "_bhomVersion" : "6.2" } }] }], "BHoM_Guid" : "dd967c59-b88d-4985-b8e4-dc991430ce6f", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { } }], "BHoM_Guid" : "79a55e2f-6935-4b65-8446-ba0a8b1a339f", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { } }], "BHoM_Guid" : "fdf495a9-cd28-4f00-a0c0-38c15f4e157e", "Name" : "DocumentationURL", "Fragments" : [], "Tags" : [], "CustomData" : { }, "_bhomVersion" : "6.2" }
Expand Up @@ -2,0 +1 @@
{ "_t" : "BH.oM.Data.Library.Dataset", "SourceInformation" : { "_t" : "BH.oM.Data.Library.Source", "SourceLink" : "https://burohappold.sharepoint.com/:u:/s/BHoM/EVonnFa-Zp5KtHg16d3T0oUBYZONvSn3KTUdfcTiUCaPpw?e=gwVj11", "Title" : "DocumentationURL", "Author" : "Peter Nugent", "ItemReference" : "", "Version" : "", "Publisher" : "", "Schema" : "", "Language" : "", "Location" : "", "Copyright" : "", "Contributors" : "Peter Nugent", "Confidence" : "Undefined", "BHoM_Guid" : "6e470430-3c70-44d0-ac7a-bc731c2912e5", "Name" : "" }, "TimeOfCreation" : { "$date" : -62135541570999 }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.UnitTest", "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Reflection.Query, Reflection_Engine, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"7.3\" }", "MethodName" : "DocumentationURL", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Reflection.MemberInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"7.3\" }"], "_bhomVersion" : "7.3" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [{ "_t" : "System.Type", "Name" : "BH.oM.Structure.Elements.Bar", "_bhomVersion" : "7.3" }], "Outputs" : [{ "_t" : "System.Collections.Generic.List`1[[BH.oM.Base.Attributes.DocumentationURLAttribute, BHoM, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null]]", "_v" : [{ "_t" : "BH.oM.Base.Attributes.DocumentationURLAttribute", "DocumentationURL" : "https://bhom.xyz/documentation/BHoM_oM/Structure_oM/BHoM-Structural-Conventions/", "Type" : "Documentation", "Description" : "", "TypeId" : { "_t" : "System.Type", "Name" : "BH.oM.Base.Attributes.DocumentationURLAttribute", "_bhomVersion" : "7.3" } }] }], "BHoM_Guid" : "a1dd2010-7a7a-42cb-aa26-3bc07a353b95", "Name" : "" }], "BHoM_Guid" : "a5bde25c-29f5-4945-9092-688600581359", "Name" : "" }], "BHoM_Guid" : "3fbf6b4f-7e36-4ad0-9ad3-35c26d166967", "Name" : "DocumentationURL", "_bhomVersion" : "7.3" }

Check notice on line 1 in .ci/Datasets/Reflection_Engine/Query/DocumentationURL.json

View check run for this annotation

BHoMBot-CI / dataset-compliance

.ci/Datasets/Reflection_Engine/Query/DocumentationURL.json#L1

Title: DocumentationURL Author: Peter Nugent Confidence: Undefined Version: Source Link: https://burohappold.sharepoint.com/:u:/s/BHoM/EVonnFa-Zp5KtHg16d3T0oUBYZONvSn3KTUdfcTiUCaPpw?e=gwVj11 Publisher: Language: Schema: Location: Copyright: Contributors: Peter Nugent Item Reference:
2 changes: 1 addition & 1 deletion .ci/Datasets/Reflection_Engine/Query/IsPrototype.json
Original file line number Diff line number Diff line change
@@ -0 +0,0 @@
{ "_t" : "BH.oM.Data.Library.Dataset", "BHoM_Guid" : "737dc236-b6e3-4883-95fc-e3ca29e7420b", "Name" : "IsPrototype", "Fragments" : [], "Tags" : [], "CustomData" : { }, "SourceInformation" : { "_t" : "BH.oM.Data.Library.Source", "BHoM_Guid" : "aa4bd1b3-a69c-4c70-88ef-9d6bd3ca337b", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "SourceLink" : "https://", "Title" : "IsPrototype", "Author" : "Fraser Greenroyd", "ItemReference" : "", "Version" : "", "Publisher" : "", "Schema" : "", "Language" : "", "Location" : "", "Copyright" : "", "Contributors" : "", "Confidence" : "High" }, "TimeOfCreation" : { "$date" : 1664893959917 }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.UnitTest", "BHoM_Guid" : "3aa5ffca-3a1d-4911-bacc-a9c58482a072", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Reflection.Query, Reflection_Engine, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"6.0\" }", "MethodName" : "IsPrototype", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"6.0\" }"], "_bhomVersion" : "6.0" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "530a3796-1f91-44c8-9a90-15fa3a68389f", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "_bhomVersion" : "6.0" }], "Outputs" : [false] }, { "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "f2ec5feb-4b6a-4164-ba36-d1b152891e52", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "BH.oM.UnitTest.Results.ComparisonDifference", "_bhomVersion" : "6.0" }], "Outputs" : [true] }, { "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "42503ef1-6c6e-4d7f-b5e2-7a2f69245684", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "BH.oM.LifeCycleAssessment.LateralStructuralMaterial", "_bhomVersion" : "6.0" }], "Outputs" : [false] }, { "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "8f433c90-e9c7-4be6-aad9-1479ae4a0010", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "BH.oM.Environment.Elements.Panel", "_bhomVersion" : "6.0" }], "Outputs" : [false] }, { "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "0e0302aa-42a2-4326-a38b-af08fb0824c4", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "_bhomVersion" : "6.0" }], "Outputs" : [false] }] }], "_bhomVersion" : "6.0" }
Expand Up @@ -2,0 +1 @@
{ "_t" : "BH.oM.Data.Library.Dataset", "SourceInformation" : { "_t" : "BH.oM.Data.Library.Source", "SourceLink" : "https://burohappold.sharepoint.com/:u:/s/BHoM/EVonnFa-Zp5KtHg16d3T0oUBYZONvSn3KTUdfcTiUCaPpw?e=gwVj11", "Title" : "DocumentationURL", "Author" : "Peter Nugent", "ItemReference" : "", "Version" : "", "Publisher" : "", "Schema" : "", "Language" : "", "Location" : "", "Copyright" : "", "Contributors" : "Peter Nugent", "Confidence" : "Undefined", "BHoM_Guid" : "6e470430-3c70-44d0-ac7a-bc731c2912e5", "Name" : "" }, "TimeOfCreation" : { "$date" : -62135541570999 }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.UnitTest", "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Reflection.Query, Reflection_Engine, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"7.3\" }", "MethodName" : "IsPrototype", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"7.3\" }"], "_bhomVersion" : "7.3" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "Inputs" : [{ "_t" : "System.Type", "Name" : "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "_bhomVersion" : "7.3" }], "Outputs" : [false], "BHoM_Guid" : "4ea3a35d-93d9-45cd-9a49-5bb6cb06d564", "Name" : "" }], "BHoM_Guid" : "6ea21ada-1d1a-4455-af8a-d49025dc4ebb", "Name" : "" }], "BHoM_Guid" : "630418b8-385f-4e5e-9b70-93ffde91d5f6", "Name" : "IsPrototype", "_bhomVersion" : "7.3" }

Check notice on line 1 in .ci/Datasets/Reflection_Engine/Query/IsPrototype.json

View check run for this annotation

BHoMBot-CI / dataset-compliance

.ci/Datasets/Reflection_Engine/Query/IsPrototype.json#L1

Title: DocumentationURL Author: Peter Nugent Confidence: Undefined Version: Source Link: https://burohappold.sharepoint.com/:u:/s/BHoM/EVonnFa-Zp5KtHg16d3T0oUBYZONvSn3KTUdfcTiUCaPpw?e=gwVj11 Publisher: Language: Schema: Location: Copyright: Contributors: Peter Nugent Item Reference:
2 changes: 1 addition & 1 deletion .ci/Datasets/Reflection_Engine/Query/Url.json

Large diffs are not rendered by default.

78 changes: 40 additions & 38 deletions .ci/unit-tests/Serialiser_Engine_Tests/AllTypesIObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,44 @@
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using BH.oM.Base;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BH.Tests.Engine.Serialiser
{
[Ignore("Ignoring NUnit versioning tests as no 100% clear action for every single class to be IObject. Usefull to be able to get this information out, but not required to be run automatically. Test kept for debugging purposes.")]
public class AllTypesIObject : BaseLoader
{
[Test]
public static void CheckAllTypesIObject()
{
List<Type> allTypes = BH.Engine.Base.Query.AllTypeList().Where(x => x.Namespace.StartsWith("BH.oM") || x.Namespace.StartsWith("BH.Revit.oM")).Where(x => !x.IsEnum).ToList();

List<Type> nonIObjects = allTypes.Where(x => !typeof(IObject).IsAssignableFrom(x)).ToList();

List<string> interfaceTypes = nonIObjects.Where(x => x.IsInterface).Select(x => x.FullName).Distinct().ToList();
List<string> classTypes = nonIObjects.Where(x => !x.IsInterface).Select(x => x.FullName).Distinct().ToList();

Console.WriteLine("Failing interface types:");
foreach (string type in interfaceTypes)
{
Console.WriteLine(type);
}

Console.WriteLine();
Console.WriteLine("Failing class types:");
foreach (string type in classTypes)
{
Console.WriteLine(type);
}
}
}
}
//using BH.oM.Base;
//using NUnit.Framework;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;


// COMMENTED OUT BECAUSE THE IGNORE ATTRIBUTE IS NOT FUNCTIONING AS INTENDED FOR CI
//namespace BH.Tests.Engine.Serialiser
//{
// [Ignore("Ignoring NUnit versioning tests as no 100% clear action for every single class to be IObject. Usefull to be able to get this information out, but not required to be run automatically. Test kept for debugging purposes.")]
// public class AllTypesIObject : BaseLoader
// {
// [Test]
// public static void CheckAllTypesIObject()
// {
// List<Type> allTypes = BH.Engine.Base.Query.AllTypeList().Where(x => x.Namespace.StartsWith("BH.oM") || x.Namespace.StartsWith("BH.Revit.oM")).Where(x => !x.IsEnum).ToList();

// List<Type> nonIObjects = allTypes.Where(x => !typeof(IObject).IsAssignableFrom(x)).ToList();

// List<string> interfaceTypes = nonIObjects.Where(x => x.IsInterface).Select(x => x.FullName).Distinct().ToList();
// List<string> classTypes = nonIObjects.Where(x => !x.IsInterface).Select(x => x.FullName).Distinct().ToList();

// Console.WriteLine("Failing interface types:");
// foreach (string type in interfaceTypes)
// {
// Console.WriteLine(type);
// }

// Console.WriteLine();
// Console.WriteLine("Failing class types:");
// foreach (string type in classTypes)
// {
// Console.WriteLine(type);
// }
// }
// }
//}

Loading