Skip to content

Commit

Permalink
Updated ids lib and improved PartOfFacet
Browse files Browse the repository at this point in the history
  • Loading branch information
CBenghi committed Oct 18, 2023
1 parent 2f19061 commit 95ae78c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="ids-lib" Version="1.0.43" />
<PackageReference Include="ids-lib" Version="1.0.47" />
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="xunit" Version="2.5.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public void CanReadIdsSamples(string idsFile)
f.Exists.Should().BeTrue("test file must be found");

var loggerMock = Substitute.For<ILogger<BuildingSmartCompatibilityTests>>(); // this is to check events
var x = LoadBuildingSmartIDS(f.FullName, loggerMock);
x.Should().NotBeNull();
var loadedIds = LoadBuildingSmartIDS(f.FullName, loggerMock);
loadedIds.Should().NotBeNull();
var errorAndWarnings = loggerMock.ReceivedCalls().Where(call => call.IsErrorType(true, true, true));
errorAndWarnings.Should().BeEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ public PartOfRelation GetRelation()
/// <param name="value"></param>
public void SetRelation(PartOfRelation value)
{
EntityRelation = value.ToString();
if (value == PartOfRelation.Undefined)
EntityRelation = string.Empty;
else
EntityRelation = value.ToString();
}

/// <summary>
Expand Down
19 changes: 16 additions & 3 deletions Xbim.InformationSpecifications/IO/Xids.Io.xml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,17 @@ private static void ExportBuildingSmartIDS(IFacet facet, XmlWriter xmlWriter, bo
case PartOfFacet pof:
xmlWriter.WriteStartElement("partOf", IdsNamespace);
WriteFacetBaseAttributes(pof, xmlWriter, logger, forRequirement, requirementOption);
xmlWriter.WriteAttributeString("relation", pof.EntityRelation.ToString());
if (pof.GetRelation() != PartOfFacet.PartOfRelation.Undefined)
xmlWriter.WriteAttributeString("relation", pof.GetRelation().ToString().ToUpperInvariant());
if (pof.EntityType is not null)
{
// todo: review the forRequirement parameter here
ExportBuildingSmartIDS(pof.EntityType, xmlWriter, false, logger, context, null);
}
else
{
logger?.LogError("Invalid null EntityType in partOf facet for buildingSmart requirements.");
}
xmlWriter.WriteEndElement();
break;
default:
Expand Down Expand Up @@ -542,8 +547,16 @@ static private void WriteFacetBaseElements(FacetBase cf, XmlWriter xmlWriter)
}
else
{
var main = XElement.Parse(File.ReadAllText(fileName));
return LoadBuildingSmartIDS(main, logger);
try
{
var main = XElement.Parse(File.ReadAllText(fileName));
return LoadBuildingSmartIDS(main, logger);
}
catch (Exception ex)
{
logger?.LogError(ex, $"{ex.Message}");
return null;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<AssemblyName>Xbim.InformationSpecifications</AssemblyName>
<RootNamespace>Xbim.InformationSpecifications</RootNamespace>
<!-- Remember to update the hardcoded AssemblyVersion property in XIDS-->
<AssemblyVersion>0.3.43</AssemblyVersion>
<AssemblyVersion>0.3.44</AssemblyVersion>
<!-- Remember to update the hardcoded AssemblyVersion property in XIDS-->
<FileVersion>$(AssemblyVersion)</FileVersion>
<Version>$(AssemblyVersion)</Version>
Expand Down Expand Up @@ -49,7 +49,7 @@
<None Include="C:\Data\Dev\XbimPrivate\Xbim.Xids\Xbim.InformationSpecifications\.editorconfig" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ids-lib" Version="1.0.43" />
<PackageReference Include="ids-lib" Version="1.0.47" />
<PackageReference Include="Nullable" Version="1.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion Xbim.InformationSpecifications/Xids.AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public partial class Xids
/// This is useful for environments that do not allow to load information from the DLL dynamically
/// (e.g. Blazor).
/// </summary>
public static string AssemblyVersion => "0.3.43";
public static string AssemblyVersion => "0.3.44";
}
}

0 comments on commit 95ae78c

Please sign in to comment.