public void DataFlowsThroughQueue() { //Arrange var queue = new FeedingQueue(0); var output = new byte[65536]; var task = Task.Factory.StartNew(() => { queue.Fill(output, 0, 32768); queue.Fill(output, 32768, output.Length - 32768); }); var bigData = new byte[100000]; //Act var buffer = new byte[5000]; for (int i = 0; i < 20; i++) { var data = Buffer(buffer.Length); Array.Copy(data, buffer, data.Length); queue.Add(buffer); Array.Copy(data, 0, bigData, data.Length * i, data.Length); } task.Wait(); //Assert var expected = bigData.Take(output.Length); Assert.That(output.SequenceEqual(expected), Is.True); }
public void SetUp() { _random = new Random(); _queue = new FeedingQueue(1000, 5000); }