public void AddRangeTest() { int count = 40; int arrayCount = 10; int index = 0; int[] intArray = new int[arrayCount]; var buffer1 = new ChainedBuffer <int>(); for (int i = 0; i < arrayCount; i++) { intArray[i] = i + count; } for (int i = 0; i < count; i++) { buffer1.Add(i); } buffer1.AddRange(intArray); foreach (var buf in buffer1) { Assert.That(buffer1.Contains(index)); ++index; } }
public void ClearTest() { int count = 40; var buffer1 = new ChainedBuffer <string>(); for (int i = 0; i < count; i++) { buffer1.Add(i.ToString()); } buffer1.Clear(); Assert.That(buffer1.Count, Is.EqualTo(0)); buffer1.Add("Hello"); Assert.That(buffer1.Count, Is.EqualTo(1)); Assert.That(buffer1.First(), Is.EqualTo("Hello")); Assert.That(buffer1.Contains("Hello")); }
public void ContainsTest() { int count = 40; int index = 0; var buffer1 = new ChainedBuffer <int>(); var buffer2 = new ChainedBuffer <string>(); for (int i = 0; i < count; i++) { buffer1.Add(i); buffer2.Add(null); } foreach (var buf in buffer1) { Assert.That(buffer1.Contains(index)); ++index; } Assert.That(buffer2.Contains(null)); }