public void GetIndexRange_EmptyCollection_Expected() { // Arrange var collection = GetEmptyIndexed <string>(); var expected = new ExpectedDirectedCollectionValue <string>( NoStrings, ReferenceEqualityComparer, collection.AllowsNull ); // Act var getIndexRange = collection.GetIndexRange(0, 0); // Assert Assert.That(getIndexRange, Is.EqualTo(expected)); }
public void Backwards_BackwardsRandomCollection_Expected() { // Arrange var collection = GetStringSequence(Random); var expected = new ExpectedDirectedCollectionValue <string>( collection.ToArray(), ReferenceEqualityComparer, collection.AllowsNull ); // Act var backwardsBackwards = collection.Backwards().Backwards(); // Assert Assert.That(backwardsBackwards, Is.EqualTo(expected)); }
public void GetIndexRange_EmptyRange_Expected() { // Arrange var collection = GetStringIndexed(Random); var startIndex = Random.Next(0, collection.Count); var expected = new ExpectedDirectedCollectionValue <string>( NoStrings, ReferenceEqualityComparer, collection.AllowsNull ); // Act var getIndexRange = collection.GetIndexRange(startIndex, 0); // Assert Assert.That(getIndexRange, Is.EqualTo(expected)); }
public void GetIndexRange_GetFullRange_Expected() { // Arrange var collection = GetStringIndexed(Random); var count = collection.Count; var expected = new ExpectedDirectedCollectionValue <string>( collection.ToArray(), ReferenceEqualityComparer, collection.AllowsNull ); // Act var getIndexRange = collection.GetIndexRange(0, count); // Assert Assert.That(getIndexRange, Is.EqualTo(expected)); }
public void Backwards_EmptyCollection_Expected() { // Arrange var collection = GetEmptySequence <string>(); var expected = new ExpectedDirectedCollectionValue <string>( NoStrings, ReferenceEqualityComparer, collection.AllowsNull, direction: Backwards ); // Act var backwards = collection.Backwards(); // Assert Assert.That(backwards, Is.EqualTo(expected)); }
public void Backwards_AllowsNull_Expected() { Run.If(AllowsNull); // Arrange var items = GetStrings(Random).WithNull(Random); var collection = GetSequence(items, allowsNull: true); var expected = new ExpectedDirectedCollectionValue <string>( collection.Reverse(), ReferenceEqualityComparer, collection.AllowsNull, direction: Backwards ); // Act var backwards = collection.Backwards(); // Assert Assert.That(backwards, Is.EqualTo(expected)); }
public void GetIndexRange_ForwardsRange_ChooseReturnsLastItem() { // Arrange var items = GetStrings(Random); var collection = new ArrayList <string>(items); var count = Random.Next(1, collection.Count); var startIndex = Random.Next(0, collection.Count - count); var expected = new ExpectedDirectedCollectionValue <string>( collection.Skip(startIndex).Take(count), collection.EqualityComparer, collection.AllowsNull, () => collection[startIndex + count - 1] ); // Act var getIndexRange = collection.GetIndexRange(startIndex, count); // Assert Assert.That(getIndexRange, Is.EqualTo(expected)); }