public void Dispose_CalledOnce_Success() { int callCount = 0; var con = new MockConnection(); con.OnCloseAsyncCore = delegate { ++callCount; return(default(ValueTask)); }; con.Dispose(); con.Dispose(); Assert.Equal(1, callCount); }
public void Dispose_CallsClose_Success() { ConnectionCloseMethod?method = null; var con = new MockConnection(); con.OnCloseAsyncCore = (m, t) => { method = m; return(default(ValueTask)); }; con.Dispose(); Assert.Equal(ConnectionCloseMethod.GracefulShutdown, method); }