public void AddItem_WithUsingComparer() { var boxComparer = new BoxSameVolumeComparer(); hashSet = new MyHashSet <Box>(boxComparer) { boxes[0], boxes[2] }; hashSet.Add(boxes[1]).Should().BeFalse(); hashSet.Should().BeEquivalentTo(boxes[0], boxes[2]); hashSet.Count.Should().Be(2); }
public void RemoveWithUsingComparer() { var boxComparer = new BoxSameVolumeComparer(); hashSet = new MyHashSet <Box>(boxComparer) { boxes[0], boxes[2] }; hashSet.Remove(boxes[1]).Should().BeTrue(); hashSet.Should().BeEquivalentTo(boxes[2]); hashSet.Count.Should().Be(1); }