diff --git a/ids-lib/LibraryInformation.cs b/ids-lib/LibraryInformation.cs
index c3bc9dc..2139705 100644
--- a/ids-lib/LibraryInformation.cs
+++ b/ids-lib/LibraryInformation.cs
@@ -26,5 +26,5 @@ public static class LibraryInformation
///
/// Static field with hardcoded DLL version number.
///
- public static string AssemblyVersion => "1.0.72";
+ public static string AssemblyVersion => "1.0.73";
}
diff --git a/ids-lib/ids-lib.csproj b/ids-lib/ids-lib.csproj
index 18e9a42..56ea1c0 100644
--- a/ids-lib/ids-lib.csproj
+++ b/ids-lib/ids-lib.csproj
@@ -20,7 +20,7 @@
First implementation.
README.md
- 1.0.72
+ 1.0.73
$(AssemblyVersion)
$(AssemblyVersion)
true
diff --git a/ids-tool.tests/Helpers/XbimFixture.cs b/ids-tool.tests/Helpers/XbimFixture.cs
new file mode 100644
index 0000000..1382a57
--- /dev/null
+++ b/ids-tool.tests/Helpers/XbimFixture.cs
@@ -0,0 +1,73 @@
+using idsTool.tests.Helpers;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using NSubstitute;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xbim.Common.Configuration;
+using Xunit;
+using static idsTool.tests.IfcFilesTests;
+
+namespace idsTool.tests.Helpers
+{
+
+ public class XbimFixture : IDisposable
+ {
+ public ILogger Logger { get; }
+
+ public XbimFixture()
+ {
+ // ... initialize xbim context ...
+ Logger = Substitute.For>();
+
+ XbimServices.Current.ConfigureServices(s =>
+ s.AddXbimToolkit(opt => opt.AddMemoryModel())
+ .AddLogging(c => configure(c, Logger))
+ );
+ }
+ private void configure(ILoggingBuilder loggingBuilder, ILogger lg)
+ {
+ loggingBuilder.AddProvider(new MyLoggerProvider(lg));
+ }
+
+ public void Dispose()
+ {
+ // ... clean up test data from the database ...
+ }
+ }
+
+
+ public class MyLoggerProvider : ILoggerProvider
+ {
+ ILogger ret;
+
+ public MyLoggerProvider(ILogger val)
+ {
+ ret = val;
+ }
+
+ public void Dispose()
+ {
+ // Dispose any resources if needed
+ }
+
+ public ILogger CreateLogger(string categoryName)
+ {
+ return ret;
+ }
+ }
+
+
+
+ [CollectionDefinition("xbim collection")]
+ public class DatabaseCollection : ICollectionFixture
+ {
+ // This class has no code, and is never created. Its purpose is simply
+ // to be the place to apply [CollectionDefinition] and all the
+ // ICollectionFixture<> interfaces.
+ }
+
+}
diff --git a/ids-tool.tests/IfcFilesTests.cs b/ids-tool.tests/IfcFilesTests.cs
index 93719f0..755037a 100644
--- a/ids-tool.tests/IfcFilesTests.cs
+++ b/ids-tool.tests/IfcFilesTests.cs
@@ -1,24 +1,35 @@
using FluentAssertions;
+using FluentAssertions.Common;
using idsTool.tests.Helpers;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using NSubstitute;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Xbim.Common.Configuration;
using Xbim.Ifc;
using Xbim.Ifc4.Interfaces;
+using Xbim.IO.Parser;
using Xunit;
using Xunit.Abstractions;
namespace idsTool.tests
{
- public class IfcFilesTests : BuildingSmartRepoFiles
+ [Collection("Database collection")]
+
+ public class IfcFilesTests : BuildingSmartRepoFiles, IClassFixture
{
- public IfcFilesTests(ITestOutputHelper outputHelper)
+ XbimFixture xbimContext;
+ public IfcFilesTests(XbimFixture fixture, ITestOutputHelper outputHelper)
{
- XunitOutputHelper = outputHelper;
+ xbimContext = fixture;
+ XunitOutputHelper = outputHelper;
}
+
private ITestOutputHelper XunitOutputHelper { get; }
[SkippableTheory]
@@ -38,10 +49,17 @@ public void IfcFileIsOk(string developmentIfcFile)
];
XunitOutputHelper.WriteLine($"Opening file `{ifcFile.FullName}`");
+ xbimContext.Logger.ClearReceivedCalls();
using var store = IfcStore.Open(ifcFile.FullName);
TestPredefinedType(store, musthave.Contains(ifcFile.Name));
+ if (ifcFile.Name == "bad.ifc")
+ xbimContext.Logger.ReceivedWithAnyArgs(1).Log(default, default);
+ else
+ xbimContext.Logger.ReceivedWithAnyArgs(0).Log(default, default);
}
+
+
private void TestPredefinedType(IfcStore store, bool mustHaveObjType)
{
var toTest = store.Instances.OfType().ToList();
diff --git a/ids-tool.tests/ids-tool.tests.csproj b/ids-tool.tests/ids-tool.tests.csproj
index 92e8663..478813b 100644
--- a/ids-tool.tests/ids-tool.tests.csproj
+++ b/ids-tool.tests/ids-tool.tests.csproj
@@ -3,7 +3,7 @@
false
false
- net8.0
+ net7.0
idsTool.tests
enable
latest
diff --git a/ids-tool/ids-tool.csproj b/ids-tool/ids-tool.csproj
index 7d5b834..310849a 100644
--- a/ids-tool/ids-tool.csproj
+++ b/ids-tool/ids-tool.csproj
@@ -16,7 +16,7 @@
icon.png
IDS, buildingSmart
- 1.0.72
+ 1.0.73
$(AssemblyVersion)
$(AssemblyVersion)
https://github.com/buildingSMART/IDS-Audit-tool.git