public void CaseRead_Async_InvalidArguments_ThrowsArgumentException() { Channel.CaseBuilder cb = Channel.CaseRead(Channel.Create <int>(), i => { }); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseRead <int>(null, (Func <int, Task>)null)); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseRead <int>(null, i => Task.CompletedTask)); Assert.Throws <ArgumentNullException>("func", () => cb.CaseRead <int>(Channel.Create <int>(), (Func <int, Task>)null)); }
public void CaseRead_Sync_InvalidArguments_ThrowsArgumentException() { Channel.CaseBuilder cb = Channel.CaseRead(Channel.Create <int>(), i => { }); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseRead <int>(null, (Action <int>)null)); Assert.Throws <ArgumentNullException>("channel", () => cb.CaseRead <int>(null, i => { })); Assert.Throws <ArgumentNullException>("action", () => cb.CaseRead <int>(Channel.Create <int>(), (Action <int>)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)); }