示例#1
0
        public void DeletingByExistingElement()
        {
            // Given
            var sortedSet = new SortedSet.SortedSet();

            sortedSet.Insert(1, "one");

            // When an existing element is deleted
            var result = sortedSet.Delete("one");

            // Then it should successfully delete
            result.Should().BeTrue();
            sortedSet.Length.Should().Be(0);
        }
示例#2
0
        public void DeletingARangeOfItems()
        {
            // Given
            var sortedSet = new SortedSet.SortedSet();

            sortedSet.Insert(1, "one");
            sortedSet.Insert(2, "two");
            sortedSet.Insert(3, "three");
            sortedSet.Insert(4, "four");

            // When deleting a range of items
            sortedSet.DeleteRangeByScore(1, 3);

            // It should successfully delete
            sortedSet.Length.Should().Be(1);
        }