public void TestBatchInvalidArgumentValidation() { Assert.Throws <ArgumentOutOfRangeException>(() => new BatchBlock <int>(-1)); Assert.Throws <ArgumentNullException>(() => new BatchBlock <int>(2, null)); Assert.True(ITargetBlockTestHelper.TestArgumentsExceptions <int>(new BatchBlock <int>(1))); Assert.True(ISourceBlockTestHelper.TestArgumentsExceptions <int[]>(new BatchBlock <int>(1))); }
public void TestTransformBlockInvalidArgumentValidation() { Assert.Throws <ArgumentNullException>(() => new TransformBlock <int, string>((Func <int, string>)null)); Assert.Throws <ArgumentNullException>(() => new TransformBlock <int, string>((Func <int, Task <string> >)null)); Assert.Throws <ArgumentNullException>(() => new TransformBlock <int, string>(i => i.ToString(), null)); Assert.Throws <ArgumentNullException>(() => new TransformBlock <int, string>(i => Task.Run(() => i.ToString()), null)); Assert.True(ITargetBlockTestHelper.TestArgumentsExceptions <int>(new TransformBlock <int, string>(i => i.ToString()))); Assert.True(ISourceBlockTestHelper.TestArgumentsExceptions <string>(new TransformBlock <int, string>(i => i.ToString()))); }
public void TestWriteOnceInvalidArgumentValidation() { bool passed = true; Assert.Throws <ArgumentNullException>(() => new WriteOnceBlock <int>(i => i, null)); passed &= ITargetBlockTestHelper.TestArgumentsExceptions <int>(new WriteOnceBlock <int>(i => i)); passed &= ISourceBlockTestHelper.TestArgumentsExceptions <int>(new WriteOnceBlock <int>(i => i)); Assert.True(passed, "Argument Validation failed."); }
public void TestJoinInvalidArgumentValidation() { 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.True(ISourceBlockTestHelper.TestArgumentsExceptions <Tuple <int, int> >(new JoinBlock <int, int>())); Assert.True(ISourceBlockTestHelper.TestArgumentsExceptions <Tuple <int, int, int> >(new JoinBlock <int, int, int>())); }
public void TestTransformManyBlockInvalidArgumentValidation() { bool passed = true; Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, string>((Func <int, IEnumerable <string> >)null)); Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, string>((Func <int, Task <IEnumerable <string> > >)null)); Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, string>(i => new[] { i.ToString() }, null)); Assert.Throws <ArgumentNullException>(() => new TransformManyBlock <int, string>(i => Task.Run(() => (IEnumerable <string>) new[] { i.ToString() }), null)); passed &= ITargetBlockTestHelper.TestArgumentsExceptions <int>(new TransformManyBlock <int, int>(i => new int[] { i })); passed &= ISourceBlockTestHelper.TestArgumentsExceptions <int>(new TransformManyBlock <int, int>(i => new int[] { i })); Assert.True(passed, "Test failed."); }
public void TestBatchedJoinInvalidArgumentValidation() { Assert.Throws <ArgumentOutOfRangeException>(() => new BatchedJoinBlock <int, int>(0)); Assert.Throws <ArgumentNullException>(() => new BatchedJoinBlock <int, int>(1, null)); Assert.Throws <ArgumentException>(() => new BatchedJoinBlock <int, int>(1, new GroupingDataflowBlockOptions { Greedy = false })); Assert.Throws <NotSupportedException>(() => { var ignored = new BatchedJoinBlock <int, int>(2).Target1.Completion; }); Assert.True(ISourceBlockTestHelper.TestArgumentsExceptions <Tuple <IList <int>, IList <int> > >(new BatchedJoinBlock <int, int>(2))); Assert.Throws <ArgumentOutOfRangeException>(() => new BatchedJoinBlock <int, int, int>(0)); Assert.Throws <ArgumentNullException>(() => new BatchedJoinBlock <int, int, int>(1, null)); Assert.Throws <ArgumentException>(() => new BatchedJoinBlock <int, int, int>(1, new GroupingDataflowBlockOptions { Greedy = false })); Assert.Throws <NotSupportedException>(() => { var ignored = new BatchedJoinBlock <int, int, int>(2).Target3.Completion; }); Assert.True(ISourceBlockTestHelper.TestArgumentsExceptions <Tuple <IList <int>, IList <int>, IList <int> > >(new BatchedJoinBlock <int, int, int>(2))); }
public void TestBroadcastBlockInvalidArgumentValidation() { Assert.Throws <ArgumentNullException>(() => new BroadcastBlock <int>(i => i, null)); Assert.True(ITargetBlockTestHelper.TestArgumentsExceptions <int>(new BroadcastBlock <int>(i => i))); Assert.True(ISourceBlockTestHelper.TestArgumentsExceptions <int>(new BroadcastBlock <int>(i => i))); }