public void GetNext_Test() { var target = new ListSequence <int>(new[] { 1, 2, 3 }, 0); target.GetNext().Should().Be(1); target.GetNext().Should().Be(2); target.GetNext().Should().Be(3); target.GetNext().Should().Be(0); }
public void IsAtEnd_Test() { var target = new ListSequence <int>(new[] { 1, 2, 3 }, 0); target.IsAtEnd.Should().BeFalse(); target.GetNext().Should().Be(1); target.IsAtEnd.Should().BeFalse(); target.GetNext().Should().Be(2); target.IsAtEnd.Should().BeFalse(); target.GetNext().Should().Be(3); target.IsAtEnd.Should().BeTrue(); }
public void CurrentLocation_Test() { var target = new ListSequence <int>(new[] { 1, 2, 3 }, 0); target.CurrentLocation.Column.Should().Be(0); target.GetNext().Should().Be(1); target.CurrentLocation.Column.Should().Be(1); target.GetNext().Should().Be(2); target.CurrentLocation.Column.Should().Be(2); target.GetNext().Should().Be(3); target.CurrentLocation.Column.Should().Be(3); target.GetNext().Should().Be(0); target.CurrentLocation.Column.Should().Be(3); }
public void Location_Rewind() { var target = new ListSequence <int>(new[] { 1, 2, 3 }, 0); target.CurrentLocation.Line.Should().Be(1); target.CurrentLocation.Column.Should().Be(0); target.GetNext(); target.CurrentLocation.Line.Should().Be(1); target.CurrentLocation.Column.Should().Be(1); var checkpoint = target.Checkpoint(); target.GetNext(); target.GetNext(); target.CurrentLocation.Line.Should().Be(1); target.CurrentLocation.Column.Should().Be(3); checkpoint.Rewind(); target.CurrentLocation.Line.Should().Be(1); target.CurrentLocation.Column.Should().Be(1); }
public void Checkpoint_Test() { var target = new ListSequence <int>(new[] { 1, 2, 3 }, 0); target.GetNext().Should().Be(1); target.GetNext().Should().Be(2); var cp = target.Checkpoint(); target.GetNext().Should().Be(3); target.GetNext().Should().Be(0); cp.Rewind(); target.GetNext().Should().Be(3); target.GetNext().Should().Be(0); }