コード例 #1
0
        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")]);
        }
コード例 #2
0
        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());
            }
        }
コード例 #3
0
        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")]);
        }
コード例 #4
0
        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());
            }
        }