Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d49f11f
Add test setup project
IsakNaslundBh May 30, 2025
515758e
Add abstract runner for datadriven UTs
IsakNaslundBh May 30, 2025
d81dd21
Base abstract runner for compliance
IsakNaslundBh May 30, 2025
8f16ead
Base abstract runner for serialisation
IsakNaslundBh May 30, 2025
1861fdf
Slight file restructure
IsakNaslundBh May 30, 2025
ead1eb4
Simplify the Static method requirement through base class and better …
IsakNaslundBh May 30, 2025
c4ba694
Minor tweaks to UTs, improving assertion and displaying message for p…
IsakNaslundBh May 30, 2025
b2bfdfa
Speed up running of checks
IsakNaslundBh Jun 4, 2025
5f5f60b
Update CurrentFolder.cs
IsakNaslundBh Jun 4, 2025
eec24d4
Updace COmpliance_oM to new format and change target of compliance_oM…
IsakNaslundBh Jun 5, 2025
c559fd3
Add method for scanning files, excluding specific folders
IsakNaslundBh Jun 5, 2025
b73cf57
bump codeAnalysis package used in TEstSetup_Engine
IsakNaslundBh Jun 5, 2025
ab15e38
Prototype for version 2 of general compliance checks, displaying all …
IsakNaslundBh Aug 27, 2025
fb622a6
Additional tweaks to handle input parameters if available
IsakNaslundBh Aug 29, 2025
5554792
_Dependencies_
IsakNaslundBh Aug 29, 2025
1daad98
Add separate test projects for different types of tests
IsakNaslundBh Sep 2, 2025
d20babb
Remove temporary postbuildevents
IsakNaslundBh Sep 2, 2025
453db1f
Change OutputPath to OutDir for code compliance
IsakNaslundBh Sep 2, 2025
babd4e7
Temporarily push up build folder content
IsakNaslundBh Sep 2, 2025
f000465
Add CI check
IsakNaslundBh Sep 2, 2025
e063454
Change strategy for assembly resolution from GlobalInit to instead ma…
IsakNaslundBh Sep 16, 2025
f57f6be
Make UnitTest_Tests into its own test project
IsakNaslundBh Sep 16, 2025
9f916c8
Clean up weird build config
IsakNaslundBh Sep 16, 2025
96efc3e
Centralise current assemblies
IsakNaslundBh Sep 16, 2025
d36b06e
Change target folder for StartupHook
IsakNaslundBh Sep 16, 2025
e6958fc
Include startup hook in the artefact
IsakNaslundBh Sep 16, 2025
7a2e23a
DO nto crash out for no UnitTest found
IsakNaslundBh Sep 16, 2025
8f03dc4
push dlls
IsakNaslundBh Sep 16, 2025
0eb0a41
bump all projects to net8.0
IsakNaslundBh Sep 18, 2025
58c59be
Update build files
IsakNaslundBh Sep 18, 2025
b5feaa2
repush dlls without hardcoded BHoM_Engine folder
IsakNaslundBh Sep 18, 2025
1fd8b6a
clean up runsettings file
IsakNaslundBh Sep 18, 2025
5bcb493
Move test projects to sln folder
IsakNaslundBh Sep 22, 2025
0d2c51a
Remove no longer required base test class
IsakNaslundBh Sep 23, 2025
2353e65
Updated build files
IsakNaslundBh Sep 23, 2025
3931949
Fix issue with startup hook polluting global environment
IsakNaslundBh Sep 24, 2025
b920320
Cleanup and separation of serialisation tests
IsakNaslundBh Sep 24, 2025
17bbc88
Repush updated dlls
IsakNaslundBh Sep 24, 2025
487e000
Try add identify tests step to workflow
IsakNaslundBh Sep 24, 2025
f9fc51e
exclude nunit.* as well from test identification
IsakNaslundBh Sep 24, 2025
2301135
Fix naming of compliance test project (add missing ending s)
IsakNaslundBh Sep 25, 2025
883af68
Fixes to code compliance
IsakNaslundBh Sep 25, 2025
b50f2f8
Fixes to project compliance to correctly fail
IsakNaslundBh Sep 25, 2025
c45521c
Repush updated dlls
IsakNaslundBh Sep 25, 2025
3b6130f
Repush dlls again
IsakNaslundBh Sep 25, 2025
b7c47eb
Repush again with correct files this time
IsakNaslundBh Sep 25, 2025
1ea13de
Improvements to handling of complaince files
IsakNaslundBh Sep 25, 2025
8102e88
build files
IsakNaslundBh Sep 25, 2025
1ca66f9
Further simplification and descriptions of the compliance runner
IsakNaslundBh Sep 26, 2025
a8a2d66
Repush dlls
IsakNaslundBh Sep 26, 2025
31f0bc7
Repush compiled dlls without hardcoded folder
IsakNaslundBh Sep 26, 2025
2291b2d
Fix issue with missing . for test files
IsakNaslundBh Sep 26, 2025
0d4dba6
Repush build files
IsakNaslundBh Sep 26, 2025
177145e
Add support for inputing current repository, or extract from git conf…
IsakNaslundBh Sep 26, 2025
597e7c8
Update build files
IsakNaslundBh Sep 26, 2025
60f19b2
Change startuphook location to C\ProgramData\BHoM folder
IsakNaslundBh Sep 26, 2025
959f45e
Change location for text file to trigger running locally
IsakNaslundBh Sep 26, 2025
d3d224c
Another dll update
IsakNaslundBh Sep 26, 2025
12f0754
Remove temporary target branch from yaml file
IsakNaslundBh Sep 29, 2025
4ca6c90
Remove buildfolder
IsakNaslundBh Sep 2, 2026
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
98 changes: 98 additions & 0 deletions .github/workflows/build-tests-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build Tests Artifact

on:
workflow_dispatch:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
collect-and-upload-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Create _Tests_ directory
run: mkdir -p _Tests_

# TODO: The toolkit will need to be built before copying files. This will need to be done before this step, including building the dependecies BHoM, BHoM_Engine and BHoM_Adapter.continue-on-error:
# TODO: For now this is just pushing up the files that are already in the Build directory to enable quicker evaluation of overall workflow of test files.
- name: Copy files from Build directory
run: |
# Copy .dll files (only from Build directory, not subdirectories)
find Build -maxdepth 1 -name "*.dll" -type f -exec cp {} _Tests_/ \;

# Copy .exe files (only from Build directory, not subdirectories)
find Build -maxdepth 1 -name "*.exe" -type f -exec cp {} _Tests_/ \;

# Copy .json files (only from Build directory, not subdirectories)
find Build -maxdepth 1 -name "*.json" -type f -exec cp {} _Tests_/ \;


# List copied files for verification
echo "Files copied to _Tests_:"
ls -la _Tests_/

- name: Identify tests
run: |
set -euo pipefail
echo "Searching for test DLLs in _Tests_ folder..."

tests_dir="_Tests_"
if [ ! -d "$tests_dir" ]; then
echo "✗ $tests_dir folder not found"
exit 1
fi

# Prepare output file
out_file="$tests_dir/TestDlls.txt"
: > "$out_file"

found=0
shopt -s nullglob
for dll in "$tests_dir"/*.dll; do
base=$(basename "$dll" .dll)

# Skip known non-test DLLs by name patterns
case "$base" in
NUnit_Engine|TestSetup_Engine|testhost|testcentric.engine.metadata|\
Microsoft.*|System.*|nunit3.*|nunit.*|NUnit3.*|Newtonsoft.*|NuGet.*)
continue ;;
*_oM|*_Engine)
continue ;;
esac

# Check for test frameworks by scanning binary strings
if command -v strings >/dev/null 2>&1; then
if strings -a "$dll" 2>/dev/null | grep -qiE '(^|/)nunit\.framework|xunit|mstest\.testframework'; then
echo "$base.dll" >> "$out_file"
echo " ✓ $base.dll"
found=$((found+1))
fi
else
if grep -a -qiE 'nunit\.framework|xunit|mstest\.testframework' "$dll"; then
echo "$base.dll" >> "$out_file"
echo " ✓ $base.dll"
found=$((found+1))
fi
fi
done

if [ "$found" -eq 0 ]; then
echo "✗ No test DLLs found in $tests_dir"
exit 1
fi

echo "✓ Wrote $found test DLL name(s) to $out_file"

- name: Upload Tests artifact
uses: actions/upload-artifact@v4
with:
name: Tests
path: |
_Tests_/
StartupHook/*.dll
retention-days: 30
74 changes: 27 additions & 47 deletions CodeComplianceTest_Engine/CodeComplianceTest_Engine.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<RootNamespace>BH.Engine.Test.CodeCompliance</RootNamespace>
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<OutputPath>..\Build\</OutputPath>
<Configurations>ComplianceTestBuild;Debug;Release</Configurations>
<AssemblyTitle>CodeComplianceTest_Engine</AssemblyTitle>
<Description>https://github.com/BHoM/Test_Toolkit</Description>
<Product>CodeComplianceTest_Engine</Product>
<Copyright>Copyright � https://github.com/BHoM</Copyright>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<FileVersion>9.3.0.0</FileVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Microsoft.CodeAnalysis.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Microsoft.CodeAnalysis.CSharp.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Buffers.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Collections.Immutable.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Memory.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Numerics.Vectors.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Reflection.Metadata.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Runtime.CompilerServices.Unsafe.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Text.Encoding.CodePages.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Threading.Tasks.Extensions.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y" />
</Target>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ComplianceTestBuild|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Build\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyVersion>8.0.0.0</AssemblyVersion>

Check failure on line 4 in CodeComplianceTest_Engine/CodeComplianceTest_Engine.csproj

View check run for this annotation

BHoMBot-CI / project-compliance

CodeComplianceTest_Engine/CodeComplianceTest_Engine.csproj#L4

Assembly Version should be set to 9.0.0.0
<Description>https://github.com/BHoM/BHoM_Engine</Description>

Check failure on line 5 in CodeComplianceTest_Engine/CodeComplianceTest_Engine.csproj

View check run for this annotation

BHoMBot-CI / project-compliance

CodeComplianceTest_Engine/CodeComplianceTest_Engine.csproj#L5

Assembly Description should contain the URL to the GitHub organisation which owns the repository
<Version>5.0.0</Version>
<Authors>BHoM</Authors>
<Copyright>Copyright © https://github.com/BHoM</Copyright>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RootNamespace>BH.Engine.Test.CodeCompliance</RootNamespace>
<FileVersion>8.2.0.0</FileVersion>

Check failure on line 11 in CodeComplianceTest_Engine/CodeComplianceTest_Engine.csproj

View check run for this annotation

BHoMBot-CI / project-compliance

CodeComplianceTest_Engine/CodeComplianceTest_Engine.csproj#L11

Assembly File Version should be set to 9.3.0.0
<OutDir>..\Build\</OutDir>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.4.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CodeCompliance_oM\CodeComplianceTest_oM.csproj" />
<ProjectReference Include="..\Test_Engine\Test_Engine.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Dimensional_oM">
<HintPath>$(ProgramData)\BHoM\Assemblies\Dimensional_oM.dll</HintPath>
Expand Down Expand Up @@ -64,27 +62,9 @@
<HintPath>$(ProgramData)\BHoM\Assemblies\Test_oM.dll</HintPath>
<Private>False</Private>
</Reference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.4.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Buffers" Version="4.6.1" />
<PackageReference Include="System.Collections.Immutable" Version="10.0.3" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Memory" Version="4.6.3" />
<PackageReference Include="System.Numerics.Vectors" Version="4.6.1" />
<PackageReference Include="System.Reflection.Metadata" Version="10.0.3" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.3" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="10.0.3" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CodeCompliance_oM\CodeComplianceTest_oM.csproj" />
<ProjectReference Include="..\Test_Engine\Test_Engine.csproj" />
</ItemGroup>
</Project>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Microsoft.CodeAnalysis.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Microsoft.CodeAnalysis.CSharp.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Buffers.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Collections.Immutable.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Memory.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Numerics.Vectors.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Reflection.Metadata.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Runtime.CompilerServices.Unsafe.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Text.Encoding.CodePages.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.Threading.Tasks.Extensions.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y" />

Check warning on line 67 in CodeComplianceTest_Engine/CodeComplianceTest_Engine.csproj

View check run for this annotation

BHoMBot-CI / project-compliance

CodeComplianceTest_Engine/CodeComplianceTest_Engine.csproj#L67

Post Build event should be correctly set to copy the compiled DLL to the BHoM Assemblies folder
</Target>

</Project>
22 changes: 21 additions & 1 deletion CodeComplianceTest_Engine/Compute/Check.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public static TestResult Check(this MethodInfo method, SyntaxNode node, string c
method.GetCustomAttributes<ConditionAttribute>().All(condition => condition.IPasses(node)) &&
(checkType != null && method.GetCustomAttribute<ComplianceTypeAttribute>()?.ComplianceType == checkType))
{
Func<object[], object> fn = method.ToFunc();
//if(fn == null)
Func<object[], object> fn = method.GetFunction();

Span result = fn(new object[] { node }) as Span;
if (result != null)
{
Expand Down Expand Up @@ -90,6 +92,24 @@ public static TestResult Check(this MethodInfo method, IEnumerable<SyntaxNode> n
}
return finalResult;
}


private static Func<object[], object> GetFunction(this MethodInfo method)
{
Func<object[], object> fn;
if (m_checkMethods.TryGetValue(method, out fn))
return fn;

fn = method.ToFunc();
lock (m_compileLock)
{
m_checkMethods[method] = fn;
}
return fn;
}

private static Dictionary<MethodInfo, Func<object[], object>> m_checkMethods = new Dictionary<MethodInfo, Func<object[], object>>();
private static object m_compileLock = new object();
}
}

Expand Down
2 changes: 1 addition & 1 deletion CodeComplianceTest_Engine/Compute/RunChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static TestResult RunChecks(this SyntaxNode node, string checkType = null
return Create.TestResult(TestStatus.Pass);

TestResult finalResult = Create.TestResult(TestStatus.Pass);
foreach(MethodInfo method in Query.AllChecks())
foreach(MethodInfo method in Query.AllChecks(checkType))
{
finalResult = finalResult.Merge(method.Check(node, checkType));
}
Expand Down
14 changes: 7 additions & 7 deletions CodeComplianceTest_Engine/Query/AllChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@
*/

using BH.oM.Test.CodeCompliance;
using BH.oM.Test.CodeCompliance.Attributes;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System.Reflection;

namespace BH.Engine.Test.CodeCompliance
{
public static partial class Query
{
public static IEnumerable<MethodInfo> AllChecks()
public static IEnumerable<MethodInfo> AllChecks(string checkType = null)
{
return Assembly.GetExecutingAssembly().DefinedTypes
.Where(t => t.IsClass && t.Name == "Query" && t.Namespace == "BH.Engine.Test.CodeCompliance.Checks")
.SelectMany(t => t.DeclaredMethods)
.Where(method => method.IsPublic && method.ReturnType == typeof(Span));
.Where(method => method.IsPublic && method.ReturnType == typeof(Span) && (checkType == null || method.GetCustomAttribute<ComplianceTypeAttribute>()?.ComplianceType == checkType));
}
}
}
Expand Down
11 changes: 0 additions & 11 deletions CodeComplianceTest_Engine/app.config

This file was deleted.

49 changes: 20 additions & 29 deletions CodeCompliance_oM/CodeComplianceTest_oM.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<RootNamespace>BH.oM.Test</RootNamespace>
<OutputPath>..\Build\</OutputPath>
<Configurations>ComplianceTestBuild;Debug;Release</Configurations>
<AssemblyTitle>Test_oM</AssemblyTitle>
<Description>https://github.com/BHoM/Test_Toolkit</Description>
<Product>Test_oM</Product>
<Copyright>Copyright � https://github.com/BHoM</Copyright>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<FileVersion>9.3.0.0</FileVersion>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y" />
</Target>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ComplianceTestBuild|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Build\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyVersion>8.0.0.0</AssemblyVersion>

Check failure on line 4 in CodeCompliance_oM/CodeComplianceTest_oM.csproj

View check run for this annotation

BHoMBot-CI / project-compliance

CodeCompliance_oM/CodeComplianceTest_oM.csproj#L4

Assembly Version should be set to 9.0.0.0
<Description>https://github.com/BHoM/BHoM_Engine</Description>

Check failure on line 5 in CodeCompliance_oM/CodeComplianceTest_oM.csproj

View check run for this annotation

BHoMBot-CI / project-compliance

CodeCompliance_oM/CodeComplianceTest_oM.csproj#L5

Assembly Description should contain the URL to the GitHub organisation which owns the repository
<Version>5.0.0</Version>
<Authors>BHoM</Authors>
<Copyright>Copyright © https://github.com/BHoM</Copyright>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RootNamespace>BH.Engine.Test.CodeCompliance</RootNamespace>
<FileVersion>8.2.0.0</FileVersion>

Check failure on line 11 in CodeCompliance_oM/CodeComplianceTest_oM.csproj

View check run for this annotation

BHoMBot-CI / project-compliance

CodeCompliance_oM/CodeComplianceTest_oM.csproj#L11

Assembly File Version should be set to 9.3.0.0
<OutDir>..\Build\</OutDir>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
<ItemGroup>
<Reference Include="Analytical_oM">
<SpecificVersion>False</SpecificVersion>
<SpecificVersion>False</SpecificVersion>
<HintPath>$(ProgramData)\BHoM\Assemblies\Analytical_oM.dll</HintPath>
<Private>False</Private>
</Reference>
Expand All @@ -41,10 +33,9 @@
<HintPath>$(ProgramData)\BHoM\Assemblies\Test_oM.dll</HintPath>
<Private>False</Private>
</Reference>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
</Project>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y" />
</Target>

</Project>
56 changes: 56 additions & 0 deletions Compliance_Tests/AssemblyInfoCompliance.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using BH.oM.Test.Results;

Check failure on line 1 in Compliance_Tests/AssemblyInfoCompliance.cs

View check run for this annotation

BHoMBot-CI / copyright-compliance

Compliance_Tests/AssemblyInfoCompliance.cs#L1

Copyright message is invalid - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/HasValidCopyright
using BH.oM.Test;
using BH.Engine.Test;
using Microsoft.CodeAnalysis;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace BH.Tests.Compliace
{
public class AssemblyInfoCompliance
{
/***************************************************/
/**** Test methods ****/
/***************************************************/

[Description("Checks a AssemblyInfoFile file by using the method available in CodeComplianceTest_Engine." +
"Potential to port the content of that method over to this file, split as individual tests, each run on the .csproj test files.")]
[TestCaseSource(nameof(AssemblyInfoFiles))]
public void TestCompliance(string fileName, string assemblyDescriptionOrg)
{
TestResult result = BH.Engine.Test.CodeCompliance.Compute.CheckAssemblyInfo(fileName, assemblyDescriptionOrg);
if (result == null)
Assert.Fail($"{fileName}: No result returned from compliance check.");

if (result.Status == TestStatus.Error)
Assert.Fail($"{fileName}: {result.FullMessage(5, TestStatus.Warning)}");

if (result.Status == TestStatus.Warning)
Assert.Warn($"{fileName}: {result.FullMessage(5, TestStatus.Warning)}");
}

/***************************************************/
/**** Test data methods ****/
/***************************************************/

[Description("Returns the AssemblyInfo cs files as well as assumed link to the repository.")]
private static IEnumerable<TestCaseData> AssemblyInfoFiles()
{
string organisationUrl = null;
string currentRepo = BH.Tests.Setup.Query.CurrentRepository();
if (currentRepo != null)
organisationUrl = $"https://github.com/{currentRepo}";

foreach (var file in BH.Tests.Setup.Query.TestFilesCs().Where(x => x.EndsWith("AssemblyInfo.cs")))
yield return new TestCaseData(new string[] { file, organisationUrl }).SetArgDisplayNames(file);

}

/***************************************************/
}
}
Loading
Loading