public void InsertingADuplicate() { // Given var sortedSet = new SortedSet.SortedSet(); sortedSet.Insert(1, "one"); // When a duplicate is inserted var result = sortedSet.Insert(1, "one"); // Then it should not insert result.Should().BeFalse(); sortedSet.Length.Should().Be(1); }
public void InsertingExistingScoreWithNewElement() { // Given var sortedSet = new SortedSet.SortedSet(); sortedSet.Insert(1, "one"); // When an existing score is inserted using new element var result = sortedSet.Insert(1, "two"); // Then it should successfully insert result.Should().BeTrue(); sortedSet.Length.Should().Be(2); }
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); }
public void InsertingNewScoreAndElement() { // Given var sortedSet = new SortedSet.SortedSet(); // When a score is inserted var result = sortedSet.Insert(1, "one"); // Then it should successfully insert result.Should().BeTrue(); sortedSet.Length.Should().Be(1); }
public void UpdatingExistingScoreWithInvalidElement() { // Given var sortedSet = new SortedSet.SortedSet(); sortedSet.Insert(1, "one"); // When an existing score is updated with invalid element var result = sortedSet.Update(1, "two", 2); // Then it should not update result.Should().BeFalse(); }
public void UpdatingExistingScoreAndElement() { // Given var sortedSet = new SortedSet.SortedSet(); sortedSet.Insert(1, "one"); // When an existing score and element are updated var result = sortedSet.Update(1, "one", 2); // Then it should successfully update result.Should().BeTrue(); }
public void DeletingByNonExistingScoreAndElement() { // Given var sortedSet = new SortedSet.SortedSet(); sortedSet.Insert(1, "one"); // When deleting a non-existing score and element var result = sortedSet.Delete(1, "two"); // Then it should not delete result.Should().BeFalse(); sortedSet.Length.Should().Be(1); }
public void DeletingByExistingScoreAndElement() { // Given var sortedSet = new SortedSet.SortedSet(); sortedSet.Insert(1, "one"); // When existing score and element are deleted var result = sortedSet.Delete(1, "one"); // Then it should successfully delete result.Should().BeTrue(); sortedSet.Length.Should().Be(0); }