public async Task TestMethod1() { var logReader = new SimpleLogReader(DataflowOptions.Default); long count = await logReader.ProcessAsync(new[] { "a", "a b", "a b c", "a b c d" }, false); long count2 = await logReader.ProcessAsync(new[] { "a", "a b", "a b c", "a b c d" }); Assert.AreEqual(4 * 2, count + count2); Assert.AreEqual(4 * 2, logReader.Recorder[new DataflowEvent("a")]); Assert.AreEqual(3 * 2, logReader.Recorder[new DataflowEvent("b")]); Assert.AreEqual(2 * 2, logReader.Recorder[new DataflowEvent("c")]); Assert.AreEqual(1 * 2, logReader.Recorder[new DataflowEvent("d")]); }
public async Task TestMethod1() { var logReader = new SimpleLogReader(DataflowOptions.Default); long count = await logReader.ProcessAsync(new[] { "a", "a b", "a b c", "a b c d" }, false); long count2 = await logReader.ProcessAsync(new[] { "a", "a b", "a b c", "a b c d" }); Assert.AreEqual(4 * 2, count + count2); Assert.AreEqual(4 * 2, logReader.Recorder[new DataflowEvent("a")]); Assert.AreEqual(3 * 2, logReader.Recorder[new DataflowEvent("b")]); Assert.AreEqual(2 * 2, logReader.Recorder[new DataflowEvent("c")]); Assert.AreEqual(1 * 2, logReader.Recorder[new DataflowEvent("d")]); }
public async Task TestMethod2() { var logReader = new SimpleLogReader(DataflowOptions.Default); try { long count = await logReader.ProcessAsync(this.GetStringSequence()); Assert.Fail("shouldn't arrive here"); } catch (Exception e) { Assert.AreEqual(typeof(OperationCanceledException), e.InnerException.GetType()); } }
public async Task TestMethod2() { var logReader = new SimpleLogReader(DataflowOptions.Default); try { long count = await logReader.ProcessAsync(this.GetStringSequence()); Assert.Fail("shouldn't arrive here"); } catch (Exception e) { Assert.AreEqual(typeof(OperationCanceledException), e.InnerException.GetType()); } }