void AddListFrom(IReadOnlyList <int> collection, IReadOnlyList <int> items, bool reversed, bool isMutated, IReadOnlyList <int> expected) { // Arrange var left = new DoublyLinkedList <int>(collection); var version = left.Version; var right = new DoublyLinkedList <int>(items); // Act left.AddFirstFrom(right, reversed); // Assert if (isMutated) { left.Version.Must().BeNotEqualTo(version); } else { left.Version.Must().BeEqualTo(version); } left.EnumerateForward().Must() .BeEnumerableOf <int>() .BeEqualTo(expected); left.EnumerateReversed().Must() .BeEnumerableOf <int>() .BeEqualTo(expected.Reverse()); right.EnumerateForward().Must() .BeEnumerableOf <int>() .BeEmpty(); }
void AddListFrom(IReadOnlyList <int> collection, IReadOnlyList <int> items, bool reversed, bool isMutated, IReadOnlyList <int> expected) { // Arrange var left = new DoublyLinkedList <int>(collection); var version = left.Version; var right = new DoublyLinkedList <int>(items); // Act left.AddFirstFrom(right, reversed); // Assert left.Count.Should().Be(expected.Count); if (isMutated) { left.Version.Should().NotBe(version); } else { left.Version.Should().Be(version); } left.EnumerateForward().Should().Equal(expected); left.EnumerateReversed().Should().Equal(expected.Reverse()); right.Count.Should().Be(0); }