public void CaseWrite_Async_InvalidArguments_ThrowsArgumentException() { Channel.CaseBuilder cb = Channel.CaseRead(Channel.Create <int>(), i => { }); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseWrite <int>(null, 0, (Func <Task>)null)); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseWrite <int>(null, 0, delegate { return(Task.CompletedTask); })); Assert.Throws <ArgumentNullException>("func", () => cb.CaseWrite <int>(Channel.Create <int>(), 0, (Func <Task>)null)); }
public void CaseWrite_Sync_InvalidArguments_ThrowsArgumentException() { Channel.CaseBuilder cb = Channel.CaseRead(Channel.Create <int>(), i => { }); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseWrite <int>(null, 0, (Action)null)); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseWrite <int>(null, 0, (Action) delegate { })); Assert.Throws <ArgumentNullException>("action", () => cb.CaseWrite <int>(Channel.Create <int>(), 0, (Action)null)); }
public void CaseReadWrite_Async_CallMultipleTimes_IdempotentResult() { Channel.CaseBuilder builder1 = Channel.CaseRead(Channel.Create <int>(), i => Task.CompletedTask); Assert.Same(builder1, builder1.CaseRead(Channel.Create <int>(), i => Task.CompletedTask)); Assert.Same(builder1, builder1.CaseWrite(Channel.Create <string>(), "", () => Task.CompletedTask)); Assert.Same(builder1, builder1.CaseDefault(() => Task.CompletedTask)); Channel.CaseBuilder builder2 = Channel.CaseWrite(Channel.Create <int>(), 0, () => Task.CompletedTask); Assert.Same(builder2, builder2.CaseRead(Channel.Create <int>(), i => Task.CompletedTask)); Assert.Same(builder2, builder2.CaseWrite(Channel.Create <string>(), "", () => Task.CompletedTask)); Assert.Same(builder2, builder2.CaseDefault(() => Task.CompletedTask)); }