Exemplo n.º 1
0
    public void SendOnClosedChannelThrows()
    {
        var ci = new Channel <int>();

        ci.Close();
        var ex = ExAssert.Catch(new Action(() => ci.Send(1).Wait()));

        Assert.IsInstanceOfType(ex.InnerException, typeof(InvalidOperationException));

        ex = null;

        var cs = new Channel <string>();

        cs.Close();
        ex = ExAssert.Catch(new Action(() => cs.Send("a").Wait()));
        Assert.IsInstanceOfType(ex.InnerException, typeof(InvalidOperationException));
    }