diff --git a/InterlockLedger.Commons.NUnit.Tests/System/LimitedRangeTests.cs b/InterlockLedger.Commons.NUnit.Tests/System/LimitedRangeTests.cs index a7084fa..225aa1a 100644 --- a/InterlockLedger.Commons.NUnit.Tests/System/LimitedRangeTests.cs +++ b/InterlockLedger.Commons.NUnit.Tests/System/LimitedRangeTests.cs @@ -112,6 +112,10 @@ private static void AssertLimitedRange(LimitedRange lr, string text, bool isInva Assert.That(lr.TextualRepresentation, Is.EqualTo(text)); string lrAsString = lr; // implicit string conversion Assert.That(lrAsString, Is.EqualTo(text)); + if (lr.IsEmpty) + Assert.That(lr.Count, Is.EqualTo((ushort)0), nameof(lr.Count)); + else + Assert.That(lr.Count, Is.EqualTo((ushort)(lr.End - lr.Start + 1)), nameof(lr.Count)); } else if (!cause.IsBlank()) Assert.That(lr.InvalidityCause, Is.EqualTo(cause).IgnoreCase); TestContext.WriteLine(lr.ToString()); diff --git a/InterlockLedger.Commons/InterlockLedger.Commons.csproj b/InterlockLedger.Commons/InterlockLedger.Commons.csproj index 75b36c1..7d0dcd4 100644 --- a/InterlockLedger.Commons/InterlockLedger.Commons.csproj +++ b/InterlockLedger.Commons/InterlockLedger.Commons.csproj @@ -11,9 +11,9 @@ InterlockLedger git https://github.com/interlockledger/interlockledger-commons.git - 18.0.0 + 18.1.0 InterlockLedger.Commons - IParsable reuse - Lots of BREAKING CHANGES + Fix initialization error in LimitedRange il2.png true true diff --git a/InterlockLedger.Commons/Types/System/LimitedRange.cs b/InterlockLedger.Commons/Types/System/LimitedRange.cs index 5377b03..0539c04 100644 --- a/InterlockLedger.Commons/Types/System/LimitedRange.cs +++ b/InterlockLedger.Commons/Types/System/LimitedRange.cs @@ -108,10 +108,12 @@ public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? prov private LimitedRange(ulong start, ulong end, string textualRepresentation) { Start = start; End = end; + Count = (ushort)(end - start + 1); TextualRepresentation = textualRepresentation; } private LimitedRange(string invalidityCause) { Start = End = ulong.MaxValue; + Count = 0; TextualRepresentation = "[?]"; InvalidityCause = invalidityCause; }