public async Task DisposeAsync_CalledOnce_Success() { int callCount = 0; var con = new MockConnection(); con.OnCloseAsyncCore = delegate { ++callCount; return(default(ValueTask)); }; await con.DisposeAsync(); await con.DisposeAsync(); Assert.Equal(1, callCount); }
public async Task DisposeAsync_CallsClose_Success() { ConnectionCloseMethod?method = null; var con = new MockConnection(); con.OnCloseAsyncCore = (m, t) => { method = m; return(default(ValueTask)); }; await con.DisposeAsync(); Assert.Equal(ConnectionCloseMethod.GracefulShutdown, method); }