public void ProcessingIsMoreExpensiveThanReading_NanosecondsLevel() { FakeCallback callback = new FakeCallback(100000, TimeSpan.FromTicks(30), TimeSpan.FromTicks(100)); var reader = new SequentialMediaReaderAndProcessor <object, object, object>(callback, CancellationToken.None); for (int i = 0; i < callback.ItemsCount; ++i) { object obj = reader.ReadAndProcessNextPieceOfData(); Assert.AreEqual(FakeCallback.ItemIdxToData(i), (int)obj); FakeCallback.DoFakeJob(TimeSpan.FromTicks(8)); } }
public void ClientStopsReadingInTheMiddleOfSenquence() { FakeCallback callback = new FakeCallback(20, TimeSpan.FromMilliseconds(20), TimeSpan.FromMilliseconds(100)); var reader = new SequentialMediaReaderAndProcessor <object, object, object>(callback, CancellationToken.None); for (int i = 0; i < callback.ItemsCount / 2; ++i) { object obj = reader.ReadAndProcessNextPieceOfData(); Assert.AreEqual(FakeCallback.ItemIdxToData(i), (int)obj); FakeCallback.DoFakeJob(TimeSpan.FromMilliseconds(20)); } }
public void ProcessingIsLessExpensiveThanReading() { FakeCallback callback = new FakeCallback(20, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(20)); var reader = new SequentialMediaReaderAndProcessor <object, object, object>(callback); for (int i = 0; i < callback.ItemsCount; ++i) { object obj = reader.ReadAndProcessNextPieceOfData(); Assert.AreEqual(FakeCallback.ItemIdxToData(i), (int)obj); FakeCallback.DoFakeJob(TimeSpan.FromMilliseconds(20)); } }