Migrated to git.privacyguard.company

This commit is contained in:
Marek Lemanczyk committed 2026-09-08 22:49:08 +02:00
1 parent 4b17a4c827
commit b5a574355e
151 files changed
+38551 -38550

No files matched your search

@@ -1,68 +1,68 @@
using FluentAssertions;
using Recyclable.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Recyclable.CollectionsTests
{
public class RecyclableSortedSetTests
{
[Fact]
public void AddShouldStoreUniqueItemsInOrder()
{
using var set = new RecyclableSortedSet<int>();
var values = new[] { 4, 1, 3, 2, 5 };
foreach (var v in values)
{
set.Add(v).Should().BeTrue();
}
set.Add(3).Should().BeFalse();
_ = set.Should().Equal(values.OrderBy(x => x));
}
[Fact]
public void RemoveShouldDeleteItem()
{
using var set = new RecyclableSortedSet<int>();
var values = new[] { 4, 1, 3, 2, 5 };
foreach (var v in values)
{
set.Add(v);
}
set.Remove(3).Should().BeTrue();
_ = set.Contains(3).Should().BeFalse();
_ = set.Should().Equal(values.Where(x => x != 3).OrderBy(x => x));
}
[Fact]
public void EnumeratorShouldYieldItemsInOrder()
{
using var set = new RecyclableSortedSet<int>();
foreach (var v in new[] { 3, 1, 4, 2 })
{
set.Add(v);
}
var result = new List<int>();
foreach (var item in set)
{
result.Add(item);
}
_ = result.Should().Equal(new[] { 1, 2, 3, 4 });
}
[Fact]
public void ShouldBeEmptyAfterClear()
{
using var set = new RecyclableSortedSet<int>();
set.Add(1);
set.Add(2);
set.Clear();
_ = set.Should().BeEmpty();
}
}
}
using FluentAssertions;
using Recyclable.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Recyclable.CollectionsTests
{
public class RecyclableSortedSetTests
{
[Fact]
public void AddShouldStoreUniqueItemsInOrder()
{
using var set = new RecyclableSortedSet<int>();
var values = new[] { 4, 1, 3, 2, 5 };
foreach (var v in values)
{
set.Add(v).Should().BeTrue();
}
set.Add(3).Should().BeFalse();
_ = set.Should().Equal(values.OrderBy(x => x));
}
[Fact]
public void RemoveShouldDeleteItem()
{
using var set = new RecyclableSortedSet<int>();
var values = new[] { 4, 1, 3, 2, 5 };
foreach (var v in values)
{
set.Add(v);
}
set.Remove(3).Should().BeTrue();
_ = set.Contains(3).Should().BeFalse();
_ = set.Should().Equal(values.Where(x => x != 3).OrderBy(x => x));
}
[Fact]
public void EnumeratorShouldYieldItemsInOrder()
{
using var set = new RecyclableSortedSet<int>();
foreach (var v in new[] { 3, 1, 4, 2 })
{
set.Add(v);
}
var result = new List<int>();
foreach (var item in set)
{
result.Add(item);
}
_ = result.Should().Equal(new[] { 1, 2, 3, 4 });
}
[Fact]
public void ShouldBeEmptyAfterClear()
{
using var set = new RecyclableSortedSet<int>();
set.Add(1);
set.Add(2);
set.Clear();
_ = set.Should().BeEmpty();
}
}
}