public void SortWithNullArrayShouldThrowException() { // Arrange SpecialArray.Collections.SpecialArray array = null; // Act Action action = () => ArrayActions.Sort(array); // Assert action.Should().Throw <ArgumentException>().WithMessage("Cannot sort a null SpecialArray"); }
public void SortArrayWithTwoElementsShouldSortTheArray() { // Arrange var items = new List <int>(new[] { 3, 1 }); SpecialArray.Collections.SpecialArray array = SpecialArray.Collections.SpecialArray.From(items); // Act ArrayActions.Sort(array); // Assert array.Items.Should().BeInAscendingOrder(); }
public void SortArrayWithThreeElementsSecondPermutationShouldSortTheArray() { // Arrange var items = new List <int>(new[] { 3, 1, 2 }); SpecialArray.Collections.SpecialArray array = SpecialArray.Collections.SpecialArray.From(items); var expectedItems = new List <int>(new[] { 1, 2, 3 }); // Act ArrayActions.Sort(array); // Assert array.Items.Should().BeInAscendingOrder(); }
public void SortArrayWithManyElementsShouldSortTheArray() { // Arrange var items = new List <int>(new[] { 7, 8, -2, 6, 2, 3, 1 }); SpecialArray.Collections.SpecialArray array = SpecialArray.Collections.SpecialArray.From(items); var expectedItems = new List <int>(new[] { -2, 1, 2, 3, 6, 7, 8 }); // Act ArrayActions.Sort(array); // Assert array.Items.Should().BeInAscendingOrder(); }