Example #1
0
        public void CouldUseIDisposableMethods()
        {
            var disposable = new TestDisposable();

            UnsafeEx.DisposeConstrained(ref disposable);

            Assert.True(disposable.Disposed);
        }
Example #2
0
        public void CouldUseGetHashCodeMethods()
        {
            var v  = 1;
            var vh = UnsafeEx.GetHashCodeConstrained(ref v);

            Assert.AreEqual(v, vh);

            var d  = new TestDisposable();
            var dh = UnsafeEx.GetHashCodeConstrained(ref d);

            Assert.AreEqual(42, dh);
        }