public void ShouldSaveWithOverflowArray() { var buffer = new CircularBuffer<int>(4); for(var i = 0; i < 6; i++) { buffer.Add(i); } var result = new [] { 3, 4, 5 }; var copy = new int[3]; buffer.CopyTo(copy, 0); Assert.AreEqual(result, copy); }
public void ShouldSaveWithoutOverflowArray() { var buffer = new CircularBuffer<int>(5); var array = new [] { 1, 2, 3, -1, 0 }; for(var i = 0; i < 3; i++) { buffer.Add(array[i]); } var copy = new int[5]; copy[3] = -1; buffer.CopyTo(copy, 0); CollectionAssert.AreEqual(array, copy); }