예제 #1
0
        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);
        }
예제 #2
0
        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);
        }