diff --git a/ids-tool.tests/Helpers/BuildingSmartRepoFiles.cs b/SolutionTooling/BuildingSmartRepoFiles.cs similarity index 94% rename from ids-tool.tests/Helpers/BuildingSmartRepoFiles.cs rename to SolutionTooling/BuildingSmartRepoFiles.cs index 531f083..3a87ff9 100644 --- a/ids-tool.tests/Helpers/BuildingSmartRepoFiles.cs +++ b/SolutionTooling/BuildingSmartRepoFiles.cs @@ -1,5 +1,4 @@ -using FluentAssertions; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -95,12 +94,11 @@ public static FileInfo GetIdsSchema() return new FileInfo(schema); } - internal static FileInfo GetDocumentationTestCaseFileInfo(string idsFile) + public static FileInfo GetDocumentationTestCaseFileInfo(string idsFile) { var d = new DirectoryInfo(IdsRepositoryTestcasesPath); var comb = d.FullName + idsFile; var f = new FileInfo(comb); - f.Exists.Should().BeTrue("test file must be found"); return f; } @@ -125,12 +123,11 @@ private static IEnumerable GetIdsOrEmpty(DirectoryInfo d) } } - internal static FileInfo GetIdsRepositoryDevelopmentFileInfo(string idsFile) + public static FileInfo GetIdsRepositoryDevelopmentFileInfo(string idsFile) { var d = new DirectoryInfo(IdsRepositoryDevelopmentPath); var comb = d.FullName + idsFile; var f = new FileInfo(comb); - f.Exists.Should().BeTrue("test file must be found"); return f; } diff --git a/SolutionTooling/SolutionTooling.csproj b/SolutionTooling/SolutionTooling.csproj new file mode 100644 index 0000000..abff79a --- /dev/null +++ b/SolutionTooling/SolutionTooling.csproj @@ -0,0 +1,9 @@ + + + + netstandard2.0 + latest + enable + + + diff --git a/ids-lib.codegen/IfcSchema_ObjectToTypeGenerator.cs b/ids-lib.codegen/IfcSchema_ObjectToTypeGenerator.cs index 579d011..bd4936e 100644 --- a/ids-lib.codegen/IfcSchema_ObjectToTypeGenerator.cs +++ b/ids-lib.codegen/IfcSchema_ObjectToTypeGenerator.cs @@ -65,7 +65,7 @@ public static string Execute() Debug.WriteLine(item); } var source = stub; - var genSchemas = new[] { IfcSchema.SchemaInfo.SchemaIfc4, IfcSchema.SchemaInfo.SchemaIfc4x3 }; + var genSchemas = new[] { "Ifc4", "Ifc4x3" }; var sourceSchemas = new[] { "IFC4", "IFC4X3_ADD1" }; for (int i = 0; i < genSchemas.Length; i++) @@ -78,7 +78,7 @@ public static string Execute() { sb.AppendLine($"\t\tschema.AddRelationType(\"{pair.ObjectName}\", \"{pair.TypeName}\");"); } - var replace = $"\r\n"; + var replace = $"\r\n"; source = source.Replace(replace, sb.ToString()); } diff --git a/ids-lib.codegen/IfcSchema_PartOfRelationGenerator.cs b/ids-lib.codegen/IfcSchema_PartOfRelationGenerator.cs index c9a8ee9..ed93f5f 100644 --- a/ids-lib.codegen/IfcSchema_PartOfRelationGenerator.cs +++ b/ids-lib.codegen/IfcSchema_PartOfRelationGenerator.cs @@ -1,6 +1,5 @@ using System.Text; using Xbim.Common.Metadata; -using static NSubstitute.Arg; namespace IdsLib.codegen; diff --git a/ids-lib.codegen/ids-lib.codegen.csproj b/ids-lib.codegen/ids-lib.codegen.csproj index 136dd80..22a8ed2 100644 --- a/ids-lib.codegen/ids-lib.codegen.csproj +++ b/ids-lib.codegen/ids-lib.codegen.csproj @@ -15,7 +15,7 @@ - + diff --git a/ids-tool.sln b/ids-tool.sln index b0cc748..e9dfa1d 100644 --- a/ids-tool.sln +++ b/ids-tool.sln @@ -19,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ids-lib", "ids-lib\ids-lib. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ids-lib.codegen", "ids-lib.codegen\ids-lib.codegen.csproj", "{B4BF756F-4399-480C-A475-CF60D587AD02}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionTooling", "SolutionTooling\SolutionTooling.csproj", "{6D103999-3F44-4586-A2AB-157098773FC4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,6 +43,10 @@ Global {B4BF756F-4399-480C-A475-CF60D587AD02}.Debug|Any CPU.Build.0 = Debug|Any CPU {B4BF756F-4399-480C-A475-CF60D587AD02}.Release|Any CPU.ActiveCfg = Release|Any CPU {B4BF756F-4399-480C-A475-CF60D587AD02}.Release|Any CPU.Build.0 = Release|Any CPU + {6D103999-3F44-4586-A2AB-157098773FC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D103999-3F44-4586-A2AB-157098773FC4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D103999-3F44-4586-A2AB-157098773FC4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D103999-3F44-4586-A2AB-157098773FC4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ids-tool.tests/AuditTests.cs b/ids-tool.tests/AuditTests.cs index bd72de0..02d714c 100644 --- a/ids-tool.tests/AuditTests.cs +++ b/ids-tool.tests/AuditTests.cs @@ -29,7 +29,7 @@ public AuditTests(ITestOutputHelper outputHelper) public void FullAuditOfDevelopmentFilesOk(string developmentIdsFile) { Skip.If(developmentIdsFile == string.Empty, "IDS repository folder not available for extra tests."); - FileInfo f = GetIdsRepositoryDevelopmentFileInfo(developmentIdsFile); + FileInfo f = LoggerAndAuditHelpers.GetAndCheckIdsRepositoryDevelopmentFileInfo(developmentIdsFile); LoggerAndAuditHelpers.FullAudit(f, XunitOutputHelper, Audit.Status.Ok, 0); } @@ -40,7 +40,7 @@ public void FullAuditOfDevelopmentFilesWithItsSchemaOk(string developmentIdsFile var repoSchema = BuildingSmartRepoFiles.GetIdsSchema(); Skip.IfNot(repoSchema.Exists, "IDS repository folder not available for extra tests."); Skip.If(developmentIdsFile == string.Empty, "IDS repository folder not available for extra tests."); - FileInfo f = GetIdsRepositoryDevelopmentFileInfo(developmentIdsFile); + FileInfo f = LoggerAndAuditHelpers.GetAndCheckIdsRepositoryDevelopmentFileInfo(developmentIdsFile); BatchOpts opt = new BatchOpts() { InputSource = f.FullName @@ -57,7 +57,7 @@ public void OmitContentAuditOfDocumentationFilesOk(string developmentIdsFile) // should the exception be prevented by the schema validation? // Skip.If(developmentIdsFile == string.Empty, "IDS repository folder not available for extra tests."); - FileInfo f = GetDocumentationTestCaseFileInfo(developmentIdsFile); + FileInfo f = LoggerAndAuditHelpers.GetAndCheckDocumentationTestCaseFileInfo(developmentIdsFile); var c = new BatchAuditOptions() { InputSource = f.FullName, @@ -80,7 +80,7 @@ public void OmitContentAuditOfDocumentationFilesOk(string developmentIdsFile) public void AuditOfDocumentationPassFilesOk(string developmentIdsFile) { Skip.If(developmentIdsFile == string.Empty, "IDS repository folder not available for extra tests."); - FileInfo f = GetDocumentationTestCaseFileInfo(developmentIdsFile); + FileInfo f = LoggerAndAuditHelpers.GetAndCheckDocumentationTestCaseFileInfo(developmentIdsFile); var c = new BatchAuditOptions() { InputSource = f.FullName, diff --git a/ids-tool.tests/Helpers/LoggerAndAuditHelpers.cs b/ids-tool.tests/Helpers/LoggerAndAuditHelpers.cs index 25882cf..3868d1b 100644 --- a/ids-tool.tests/Helpers/LoggerAndAuditHelpers.cs +++ b/ids-tool.tests/Helpers/LoggerAndAuditHelpers.cs @@ -16,7 +16,23 @@ namespace idsTool.tests.Helpers; internal static class LoggerAndAuditHelpers { - internal static Audit.Status AuditWithoutExpectations(BatchAuditOptions c, ITestOutputHelper OutputHelper) + public static FileInfo GetAndCheckIdsRepositoryDevelopmentFileInfo(string idsFile) + { + FileInfo f = BuildingSmartRepoFiles.GetIdsRepositoryDevelopmentFileInfo(idsFile); + f.Exists.Should().BeTrue("test file must be found"); + return f; + } + public static FileInfo GetAndCheckDocumentationTestCaseFileInfo(string idsFile) + { + FileInfo f = BuildingSmartRepoFiles.GetDocumentationTestCaseFileInfo(idsFile); + f.Exists.Should().BeTrue("test file must be found"); + return f; + } + + + + + internal static Audit.Status AuditWithoutExpectations(BatchAuditOptions c, ITestOutputHelper OutputHelper) { return BatchAuditWithOptions(c, OutputHelper, null, -1); } diff --git a/ids-tool.tests/IdsInfoTests.cs b/ids-tool.tests/IdsInfoTests.cs index 7e73cc3..2f9d7d8 100644 --- a/ids-tool.tests/IdsInfoTests.cs +++ b/ids-tool.tests/IdsInfoTests.cs @@ -30,7 +30,7 @@ public async Task InvalidFilesDontBreak(string idsFile, bool isIds) public async Task CanReadIdsDevelopmentFiles(string idsFile) { Skip.If(idsFile == string.Empty, "IDS repository folder not available for extra tests."); - FileInfo f = GetIdsRepositoryDevelopmentFileInfo(idsFile); + FileInfo f = LoggerAndAuditHelpers.GetAndCheckIdsRepositoryDevelopmentFileInfo(idsFile); var t = await IdsXmlHelpers.GetIdsInformationAsync(f); t.Should().NotBeNull(); t.Version.Should().NotBe(IdsVersion.Invalid); @@ -41,7 +41,7 @@ public async Task CanReadIdsDevelopmentFiles(string idsFile) public async Task CanReadIdsTestCases(string idsFile) { Skip.If(idsFile == string.Empty, "IDS repository folder not available for extra tests."); - FileInfo f = GetDocumentationTestCaseFileInfo(idsFile); + FileInfo f = LoggerAndAuditHelpers.GetAndCheckDocumentationTestCaseFileInfo(idsFile); var idsInformation = await IdsXmlHelpers.GetIdsInformationAsync(f); idsInformation.Should().NotBeNull(); var schemaVersion = idsInformation.Version; diff --git a/ids-tool.tests/SchemaLoadingTests.cs b/ids-tool.tests/SchemaLoadingTests.cs index 1cd5c7c..3b33ac5 100644 --- a/ids-tool.tests/SchemaLoadingTests.cs +++ b/ids-tool.tests/SchemaLoadingTests.cs @@ -25,7 +25,7 @@ public SchemaLoadingTests(ITestOutputHelper outputHelper) public void CanLoadEmbeddedResourceSchema(string idsFile) { Skip.If(idsFile == string.Empty, "IDS repository folder not available for extra tests."); - FileInfo f = GetIdsRepositoryDevelopmentFileInfo(idsFile); + FileInfo f = LoggerAndAuditHelpers.GetAndCheckIdsRepositoryDevelopmentFileInfo(idsFile); var c = new BatchAuditOptions() { InputSource = f.FullName, diff --git a/ids-tool.tests/TestingSuiteSelfTests.cs b/ids-tool.tests/TestingSuiteSelfTests.cs index 97f4f5e..788bc89 100644 --- a/ids-tool.tests/TestingSuiteSelfTests.cs +++ b/ids-tool.tests/TestingSuiteSelfTests.cs @@ -26,8 +26,7 @@ public void IdsRepositoryFileMethodsAreCoherent() var str = Frststr as string; if (str == "") // repository not found continue; - var f = BuildingSmartRepoFiles.GetDocumentationTestCaseFileInfo(str!); - f.Should().NotBeNull(); + var f = LoggerAndAuditHelpers.GetAndCheckDocumentationTestCaseFileInfo(str!); f.Exists.Should().BeTrue($"{str} is returned from the automation code"); } } diff --git a/ids-tool.tests/ids-tool.tests.csproj b/ids-tool.tests/ids-tool.tests.csproj index 5de1694..a3bb62f 100644 --- a/ids-tool.tests/ids-tool.tests.csproj +++ b/ids-tool.tests/ids-tool.tests.csproj @@ -27,6 +27,7 @@ +