Initial curated itworx-knowledge-hub source from 3b1751d0d9dee551aa6994eee0093704dc334817
This commit is contained in:
commit
ad8ad252a9
825 files changed
+124216
No files matched your search
@@ -0,0 +1,36 @@
|
||||
using ItWorx.KnowledgeHub.Domain.Knowledge;
|
||||
|
||||
namespace ItWorx.KnowledgeHub.Domain.Tests;
|
||||
|
||||
public sealed class SortKeyTests
|
||||
{
|
||||
[Fact]
|
||||
public void Next_produces_a_key_that_sorts_after_the_previous_one()
|
||||
{
|
||||
var first = SortKey.First();
|
||||
var second = SortKey.Next(first);
|
||||
var third = SortKey.Next(second);
|
||||
|
||||
Assert.True(string.CompareOrdinal(first.Value, second.Value) < 0);
|
||||
Assert.True(string.CompareOrdinal(second.Value, third.Value) < 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Between_produces_a_key_strictly_between_two_others()
|
||||
{
|
||||
var lower = SortKey.First();
|
||||
var upper = SortKey.Next(lower);
|
||||
var middle = SortKey.Between(lower, upper);
|
||||
|
||||
Assert.True(string.CompareOrdinal(lower.Value, middle.Value) < 0);
|
||||
Assert.True(string.CompareOrdinal(middle.Value, upper.Value) < 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void All_keys_share_the_same_fixed_width_for_stable_ordinal_comparison()
|
||||
{
|
||||
var keys = new[] { SortKey.First(), SortKey.Next(SortKey.First()) };
|
||||
|
||||
Assert.All(keys, key => Assert.Equal(keys[0].Value.Length, key.Value.Length));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user