Beispiel #1
0
        public void TestLinkLeftToNull2()
        {
            var faultyContainer   = new FaultyBlocks();
            var involvedContainer = new InnocentBlocks();

            faultyContainer.LinkLeftToNull();
            faultyContainer.LinkSubTypeTo(involvedContainer);
        }
        public void TestLinkLeftToNull2()
        {
            var faultyContainer   = new FaultyBlocks();
            var involvedContainer = new InnocentBlocks();

            faultyContainer.LinkLeftToNull();
            faultyContainer.TransformAndLink(involvedContainer);
        }
        public async Task TestTermination()
        {
            var faultyContainer   = new FaultyBlocks();
            var involvedContainer = new InnocentBlocks();

            faultyContainer.TransformAndLink(involvedContainer);
            faultyContainer.LinkLeftToNull();

            faultyContainer.InputBlock.Post("test");

            await EnsureTaskFail <SystemException>(faultyContainer.CompletionTask);
            await EnsureTaskFail <LinkedContainerFailedException>(involvedContainer.CompletionTask);
        }
        public async Task TestContainerName()
        {
            var block1     = new TransformBlock <string, string>(i => i);
            var block2     = new TransformBlock <string, string>(i => i);
            var container1 = BlockContainerUtils.FromBlock(block1);
            var container2 = BlockContainerUtils.FromBlock(block2);
            var container3 = new FaultyBlocks();
            var container4 = new FaultyBlocks();

            Assert.AreEqual("PropagatorBlockContainer<String, String>1", container1.Name);
            Assert.AreEqual("PropagatorBlockContainer<String, String>2", container2.Name);
            Assert.IsTrue(container3.Name.StartsWith("FaultyBlocks"));
            Assert.IsTrue(container4.Name.StartsWith("FaultyBlocks"));
        }
Beispiel #5
0
        public async Task TestTermination()
        {
            var faultyContainer   = new FaultyBlocks();
            var involvedContainer = new InnocentBlocks();

            faultyContainer.LinkTo(involvedContainer);

            var cts = new CancellationTokenSource();

            faultyContainer.RegisterCancellationTokenSource(cts);
            faultyContainer.InputBlock.Post("test");

            var sleepingTask = Task.Delay(TimeSpan.FromDays(1), cts.Token);

            await EnsureTaskFail <SystemException>(faultyContainer.CompletionTask);
            await EnsureTaskFail <LinkedDataflowFailedException>(involvedContainer.CompletionTask);

            Assert.IsTrue(await sleepingTask.FinishesIn(TimeSpan.FromSeconds(1)));
        }
Beispiel #6
0
        public void TestContainerName()
        {
            var block1     = new TransformBlock <string, string>(i => i);
            var block2     = new TransformBlock <string, string>(i => i);
            var container1 = DataflowUtils.FromBlock(block1);
            var container2 = DataflowUtils.FromBlock(block2);
            var container3 = new FaultyBlocks();
            var container4 = new FaultyBlocks();

            Assert.AreEqual("[PropagatorDataflow<String, String>1]", container1.FullName);
            Assert.AreEqual("[PropagatorDataflow<String, String>2]", container2.FullName);
            Assert.IsTrue(container3.Name.StartsWith("FaultyBlocks"));
            Assert.IsTrue(container4.Name.StartsWith("FaultyBlocks"));

            container3.RegisterChild(container1);
            container4.RegisterChild(container2);

            Assert.IsTrue(container1.FullName.StartsWith("[FaultyBlocks"));
            Assert.IsTrue(container2.FullName.StartsWith("[FaultyBlocks"));
        }
Beispiel #7
0
        public void TestLinkLeftToNull3()
        {
            var faultyContainer = new FaultyBlocks();

            faultyContainer.LinkLeftToNull();
        }