public void TestArgumentExceptionsAsyncEnumerable()
        {
            Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, int>((Func <int, IAsyncEnumerable <int> >)null));
            Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, int>(DataflowTestHelpers.ToAsyncEnumerable, null));

            DataflowTestHelpers.TestArgumentsExceptions(new TransformManyBlock <int, int>(DataflowTestHelpers.ToAsyncEnumerable));
        }
        public void TestArgumentExceptions()
        {
            Assert.Throws <ArgumentOutOfRangeException>(() => new BatchedJoinBlock <int, string>(-1));
            Assert.Throws <ArgumentNullException>(() => new BatchedJoinBlock <int, string>(2, null));
            AssertExtensions.Throws <ArgumentException>("dataflowBlockOptions", () => new BatchedJoinBlock <int, string>(2, new GroupingDataflowBlockOptions {
                Greedy = false
            }));
            AssertExtensions.Throws <ArgumentException>("dataflowBlockOptions", () => new BatchedJoinBlock <int, string>(2, new GroupingDataflowBlockOptions {
                BoundedCapacity = 2
            }));
            Assert.Throws <ArgumentNullException>(() => ((IDataflowBlock) new BatchedJoinBlock <int, string>(2)).Fault(null));
            Assert.Throws <ArgumentNullException>(() => new BatchedJoinBlock <int, string>(2).Target1.Fault(null));

            Assert.Throws <ArgumentOutOfRangeException>(() => new BatchedJoinBlock <int, string, double>(-1));
            Assert.Throws <ArgumentNullException>(() => new BatchedJoinBlock <int, string, double>(2, null));
            AssertExtensions.Throws <ArgumentException>("dataflowBlockOptions", () => new BatchedJoinBlock <int, string, double>(2, new GroupingDataflowBlockOptions {
                Greedy = false
            }));
            AssertExtensions.Throws <ArgumentException>("dataflowBlockOptions", () => new BatchedJoinBlock <int, string, double>(2, new GroupingDataflowBlockOptions {
                BoundedCapacity = 2
            }));
            Assert.Throws <ArgumentNullException>(() => ((IDataflowBlock) new BatchedJoinBlock <int, string, double>(2)).Fault(null));

            DataflowTestHelpers.TestArgumentsExceptions(new BatchedJoinBlock <int, string>(1));
            DataflowTestHelpers.TestArgumentsExceptions(new BatchedJoinBlock <int, string, double>(1));
        }
예제 #3
0
 public void TestArgumentExceptions()
 {
     Assert.Throws <ArgumentNullException>(() => new BroadcastBlock <int>(i => i, null));
     AssertExtensions.Throws <ArgumentException>("messageHeader", () =>
                                                 ((ITargetBlock <int>) new BroadcastBlock <int>(null)).OfferMessage(default(DataflowMessageHeader), 0, null, consumeToAccept: false));
     AssertExtensions.Throws <ArgumentException>("consumeToAccept", () =>
                                                 ((ITargetBlock <int>) new BroadcastBlock <int>(null)).OfferMessage(new DataflowMessageHeader(1), 0, null, consumeToAccept: true));
     DataflowTestHelpers.TestArgumentsExceptions(new BroadcastBlock <int>(i => i));
 }
예제 #4
0
        public void TestArgumentExceptions()
        {
            Assert.Throws <ArgumentNullException>(() => new TransformBlock <int, int>((Func <int, int>)null));
            Assert.Throws <ArgumentNullException>(() => new TransformBlock <int, int>((Func <int, Task <int> >)null));
            Assert.Throws <ArgumentNullException>(() => new TransformBlock <int, int>(i => i, null));
            Assert.Throws <ArgumentNullException>(() => new TransformBlock <int, int>(i => Task.Run(() => i), null));

            DataflowTestHelpers.TestArgumentsExceptions(new TransformBlock <int, int>(i => i));
        }
예제 #5
0
 public void TestArgumentExceptions()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => new BatchBlock <int>(-1));
     Assert.Throws <ArgumentNullException>(() => new BatchBlock <int>(2, null));
     Assert.Throws <ArgumentOutOfRangeException>(() => new BatchBlock <int>(2, new GroupingDataflowBlockOptions {
         BoundedCapacity = 1
     }));
     DataflowTestHelpers.TestArgumentsExceptions(new BatchBlock <int>(1));
 }
예제 #6
0
        public void TestArgumentExceptions()
        {
            Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, int>((Func <int, IEnumerable <int> >)null));
            Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, int>((Func <int, Task <IEnumerable <int> > >)null));
            Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, int>(DataflowTestHelpers.ToEnumerable, null));
            Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, int>(i => Task.Run(() => DataflowTestHelpers.ToEnumerable(i)), null));

            DataflowTestHelpers.TestArgumentsExceptions(new TransformManyBlock <int, int>(DataflowTestHelpers.ToEnumerable));
        }
예제 #7
0
        public void TestArgumentExceptions()
        {
            Assert.Throws <ArgumentNullException>(() => new JoinBlock <int, int>(null));
            Assert.Throws <ArgumentNullException>(() => new JoinBlock <int, int, int>(null));
            Assert.Throws <NotSupportedException>(() => { var ignored = new JoinBlock <int, int>().Target1.Completion; });
            Assert.Throws <NotSupportedException>(() => { var ignored = new JoinBlock <int, int, int>().Target3.Completion; });

            DataflowTestHelpers.TestArgumentsExceptions <Tuple <int, int> >(new JoinBlock <int, int>());
            DataflowTestHelpers.TestArgumentsExceptions <Tuple <int, int, int> >(new JoinBlock <int, int, int>());
        }
예제 #8
0
        public void TestArgumentExceptions()
        {
            Assert.Throws <ArgumentNullException>(() => new JoinBlock <int, int>(null));
            Assert.Throws <ArgumentNullException>(() => new JoinBlock <int, int, int>(null));
            Assert.Throws <NotSupportedException>(() => { var ignored = new JoinBlock <int, int>().Target1.Completion; });
            Assert.Throws <NotSupportedException>(() => { var ignored = new JoinBlock <int, int, int>().Target3.Completion; });
            Assert.Throws <ArgumentNullException>(() => new JoinBlock <int, int>().Target1.Fault(null));
            Assert.Throws <ArgumentException>(() => new JoinBlock <int, int>().Target1.OfferMessage(default(DataflowMessageHeader), 1, null, false));
            Assert.Throws <ArgumentException>(() => new JoinBlock <int, int>().Target1.OfferMessage(new DataflowMessageHeader(1), 1, null, true));

            DataflowTestHelpers.TestArgumentsExceptions <Tuple <int, int> >(new JoinBlock <int, int>());
            DataflowTestHelpers.TestArgumentsExceptions <Tuple <int, int, int> >(new JoinBlock <int, int, int>());
        }
예제 #9
0
 public void TestArgumentExceptions()
 {
     Assert.Throws <ArgumentNullException>(() => new WriteOnceBlock <int>(i => i, null));
     DataflowTestHelpers.TestArgumentsExceptions(new WriteOnceBlock <int>(i => i));
     Assert.Throws <ArgumentNullException>(() => ((ITargetBlock <int>) new WriteOnceBlock <int>(null)).Fault(null));
 }
예제 #10
0
 public void TestArgumentExceptions()
 {
     Assert.Throws <ArgumentNullException>(() => new BufferBlock <int>(null));
     DataflowTestHelpers.TestArgumentsExceptions(new BufferBlock <int>());
 }