Skip to content

Commit 5e0ecd0

Browse files
committed
Fixes #24
1 parent f967e1a commit 5e0ecd0

12 files changed

+47
-20
lines changed

ids-tool.tests/Helpers/BuildingSmartRepoFiles.cs renamed to SolutionTooling/BuildingSmartRepoFiles.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using FluentAssertions;
2-
using System;
1+
using System;
32
using System.Collections.Generic;
43
using System.IO;
54
using System.Linq;
@@ -95,12 +94,11 @@ public static FileInfo GetIdsSchema()
9594
return new FileInfo(schema);
9695
}
9796

98-
internal static FileInfo GetDocumentationTestCaseFileInfo(string idsFile)
97+
public static FileInfo GetDocumentationTestCaseFileInfo(string idsFile)
9998
{
10099
var d = new DirectoryInfo(IdsRepositoryTestcasesPath);
101100
var comb = d.FullName + idsFile;
102101
var f = new FileInfo(comb);
103-
f.Exists.Should().BeTrue("test file must be found");
104102
return f;
105103
}
106104

@@ -125,12 +123,11 @@ private static IEnumerable<object[]> GetIdsOrEmpty(DirectoryInfo d)
125123
}
126124
}
127125

128-
internal static FileInfo GetIdsRepositoryDevelopmentFileInfo(string idsFile)
126+
public static FileInfo GetIdsRepositoryDevelopmentFileInfo(string idsFile)
129127
{
130128
var d = new DirectoryInfo(IdsRepositoryDevelopmentPath);
131129
var comb = d.FullName + idsFile;
132130
var f = new FileInfo(comb);
133-
f.Exists.Should().BeTrue("test file must be found");
134131
return f;
135132
}
136133

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<LangVersion>latest</LangVersion>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
</Project>

ids-lib.codegen/IfcSchema_ObjectToTypeGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static string Execute()
6565
Debug.WriteLine(item);
6666
}
6767
var source = stub;
68-
var genSchemas = new[] { IfcSchema.SchemaInfo.SchemaIfc4, IfcSchema.SchemaInfo.SchemaIfc4x3 };
68+
var genSchemas = new[] { "Ifc4", "Ifc4x3" };
6969
var sourceSchemas = new[] { "IFC4", "IFC4X3_ADD1" };
7070

7171
for (int i = 0; i < genSchemas.Length; i++)
@@ -78,7 +78,7 @@ public static string Execute()
7878
{
7979
sb.AppendLine($"\t\tschema.AddRelationType(\"{pair.ObjectName}\", \"{pair.TypeName}\");");
8080
}
81-
var replace = $"<PlaceHolder{schema.Version}>\r\n";
81+
var replace = $"<PlaceHolder{schema}>\r\n";
8282
source = source.Replace(replace, sb.ToString());
8383

8484
}

ids-lib.codegen/IfcSchema_PartOfRelationGenerator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Text;
22
using Xbim.Common.Metadata;
3-
using static NSubstitute.Arg;
43

54
namespace IdsLib.codegen;
65

ids-lib.codegen/ids-lib.codegen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<PackageReference Include="XmlDocMarkdown.Core" Version="2.9.0" />
1616
</ItemGroup>
1717
<ItemGroup>
18-
<ProjectReference Include="..\ids-tool.tests\ids-tool.tests.csproj" />
18+
<ProjectReference Include="..\SolutionTooling\SolutionTooling.csproj" />
1919
</ItemGroup>
2020
<ItemGroup>
2121
<None Update="buildingSMART\IFC_TYPES_MAPPING_BPS.csv">

ids-tool.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ids-lib", "ids-lib\ids-lib.
1919
EndProject
2020
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ids-lib.codegen", "ids-lib.codegen\ids-lib.codegen.csproj", "{B4BF756F-4399-480C-A475-CF60D587AD02}"
2121
EndProject
22+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionTooling", "SolutionTooling\SolutionTooling.csproj", "{6D103999-3F44-4586-A2AB-157098773FC4}"
23+
EndProject
2224
Global
2325
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2426
Debug|Any CPU = Debug|Any CPU
@@ -41,6 +43,10 @@ Global
4143
{B4BF756F-4399-480C-A475-CF60D587AD02}.Debug|Any CPU.Build.0 = Debug|Any CPU
4244
{B4BF756F-4399-480C-A475-CF60D587AD02}.Release|Any CPU.ActiveCfg = Release|Any CPU
4345
{B4BF756F-4399-480C-A475-CF60D587AD02}.Release|Any CPU.Build.0 = Release|Any CPU
46+
{6D103999-3F44-4586-A2AB-157098773FC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47+
{6D103999-3F44-4586-A2AB-157098773FC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
48+
{6D103999-3F44-4586-A2AB-157098773FC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
49+
{6D103999-3F44-4586-A2AB-157098773FC4}.Release|Any CPU.Build.0 = Release|Any CPU
4450
EndGlobalSection
4551
GlobalSection(SolutionProperties) = preSolution
4652
HideSolutionNode = FALSE

ids-tool.tests/AuditTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public AuditTests(ITestOutputHelper outputHelper)
2929
public void FullAuditOfDevelopmentFilesOk(string developmentIdsFile)
3030
{
3131
Skip.If(developmentIdsFile == string.Empty, "IDS repository folder not available for extra tests.");
32-
FileInfo f = GetIdsRepositoryDevelopmentFileInfo(developmentIdsFile);
32+
FileInfo f = LoggerAndAuditHelpers.GetAndCheckIdsRepositoryDevelopmentFileInfo(developmentIdsFile);
3333
LoggerAndAuditHelpers.FullAudit(f, XunitOutputHelper, Audit.Status.Ok, 0);
3434
}
3535

@@ -40,7 +40,7 @@ public void FullAuditOfDevelopmentFilesWithItsSchemaOk(string developmentIdsFile
4040
var repoSchema = BuildingSmartRepoFiles.GetIdsSchema();
4141
Skip.IfNot(repoSchema.Exists, "IDS repository folder not available for extra tests.");
4242
Skip.If(developmentIdsFile == string.Empty, "IDS repository folder not available for extra tests.");
43-
FileInfo f = GetIdsRepositoryDevelopmentFileInfo(developmentIdsFile);
43+
FileInfo f = LoggerAndAuditHelpers.GetAndCheckIdsRepositoryDevelopmentFileInfo(developmentIdsFile);
4444

4545
BatchOpts opt = new BatchOpts() {
4646
InputSource = f.FullName
@@ -57,7 +57,7 @@ public void OmitContentAuditOfDocumentationFilesOk(string developmentIdsFile)
5757
// should the exception be prevented by the schema validation?
5858
//
5959
Skip.If(developmentIdsFile == string.Empty, "IDS repository folder not available for extra tests.");
60-
FileInfo f = GetDocumentationTestCaseFileInfo(developmentIdsFile);
60+
FileInfo f = LoggerAndAuditHelpers.GetAndCheckDocumentationTestCaseFileInfo(developmentIdsFile);
6161
var c = new BatchAuditOptions()
6262
{
6363
InputSource = f.FullName,
@@ -80,7 +80,7 @@ public void OmitContentAuditOfDocumentationFilesOk(string developmentIdsFile)
8080
public void AuditOfDocumentationPassFilesOk(string developmentIdsFile)
8181
{
8282
Skip.If(developmentIdsFile == string.Empty, "IDS repository folder not available for extra tests.");
83-
FileInfo f = GetDocumentationTestCaseFileInfo(developmentIdsFile);
83+
FileInfo f = LoggerAndAuditHelpers.GetAndCheckDocumentationTestCaseFileInfo(developmentIdsFile);
8484
var c = new BatchAuditOptions()
8585
{
8686
InputSource = f.FullName,

ids-tool.tests/Helpers/LoggerAndAuditHelpers.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,23 @@ namespace idsTool.tests.Helpers;
1616

1717
internal static class LoggerAndAuditHelpers
1818
{
19-
internal static Audit.Status AuditWithoutExpectations(BatchAuditOptions c, ITestOutputHelper OutputHelper)
19+
public static FileInfo GetAndCheckIdsRepositoryDevelopmentFileInfo(string idsFile)
20+
{
21+
FileInfo f = BuildingSmartRepoFiles.GetIdsRepositoryDevelopmentFileInfo(idsFile);
22+
f.Exists.Should().BeTrue("test file must be found");
23+
return f;
24+
}
25+
public static FileInfo GetAndCheckDocumentationTestCaseFileInfo(string idsFile)
26+
{
27+
FileInfo f = BuildingSmartRepoFiles.GetDocumentationTestCaseFileInfo(idsFile);
28+
f.Exists.Should().BeTrue("test file must be found");
29+
return f;
30+
}
31+
32+
33+
34+
35+
internal static Audit.Status AuditWithoutExpectations(BatchAuditOptions c, ITestOutputHelper OutputHelper)
2036
{
2137
return BatchAuditWithOptions(c, OutputHelper, null, -1);
2238
}

ids-tool.tests/IdsInfoTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public async Task InvalidFilesDontBreak(string idsFile, bool isIds)
3030
public async Task CanReadIdsDevelopmentFiles(string idsFile)
3131
{
3232
Skip.If(idsFile == string.Empty, "IDS repository folder not available for extra tests.");
33-
FileInfo f = GetIdsRepositoryDevelopmentFileInfo(idsFile);
33+
FileInfo f = LoggerAndAuditHelpers.GetAndCheckIdsRepositoryDevelopmentFileInfo(idsFile);
3434
var t = await IdsXmlHelpers.GetIdsInformationAsync(f);
3535
t.Should().NotBeNull();
3636
t.Version.Should().NotBe(IdsVersion.Invalid);
@@ -41,7 +41,7 @@ public async Task CanReadIdsDevelopmentFiles(string idsFile)
4141
public async Task CanReadIdsTestCases(string idsFile)
4242
{
4343
Skip.If(idsFile == string.Empty, "IDS repository folder not available for extra tests.");
44-
FileInfo f = GetDocumentationTestCaseFileInfo(idsFile);
44+
FileInfo f = LoggerAndAuditHelpers.GetAndCheckDocumentationTestCaseFileInfo(idsFile);
4545
var idsInformation = await IdsXmlHelpers.GetIdsInformationAsync(f);
4646
idsInformation.Should().NotBeNull();
4747
var schemaVersion = idsInformation.Version;

ids-tool.tests/SchemaLoadingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public SchemaLoadingTests(ITestOutputHelper outputHelper)
2525
public void CanLoadEmbeddedResourceSchema(string idsFile)
2626
{
2727
Skip.If(idsFile == string.Empty, "IDS repository folder not available for extra tests.");
28-
FileInfo f = GetIdsRepositoryDevelopmentFileInfo(idsFile);
28+
FileInfo f = LoggerAndAuditHelpers.GetAndCheckIdsRepositoryDevelopmentFileInfo(idsFile);
2929
var c = new BatchAuditOptions()
3030
{
3131
InputSource = f.FullName,

ids-tool.tests/TestingSuiteSelfTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ public void IdsRepositoryFileMethodsAreCoherent()
2626
var str = Frststr as string;
2727
if (str == "") // repository not found
2828
continue;
29-
var f = BuildingSmartRepoFiles.GetDocumentationTestCaseFileInfo(str!);
30-
f.Should().NotBeNull();
29+
var f = LoggerAndAuditHelpers.GetAndCheckDocumentationTestCaseFileInfo(str!);
3130
f.Exists.Should().BeTrue($"{str} is returned from the automation code");
3231
}
3332
}

ids-tool.tests/ids-tool.tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<ItemGroup>
2828
<ProjectReference Include="..\ids-lib\ids-lib.csproj" />
2929
<ProjectReference Include="..\ids-tool\ids-tool.csproj" />
30+
<ProjectReference Include="..\SolutionTooling\SolutionTooling.csproj" />
3031
</ItemGroup>
3132

3233
<ItemGroup>

0 commit comments

Comments
 (0)