示例#1
0
        public void TestNativeHandleDisposal()
        {
            NativeTestLib lib          = new NativeTestLib();
            int           initDogCount = Dog.NumNativeInstances;

            Dog dog = new Dog();

            Assert.Equal(initDogCount + 1, Dog.NumNativeInstances);
            Assert.Equal(1, dog.ReferenceCount);
            Assert.Equal(1, dog.NativeReferenceCount);
            dog.Dispose();
            Assert.Equal(initDogCount, Dog.NumNativeInstances);
        }
 protected CustomNativeHandle()
     : base()
 {
     this.api = new NativeTestLib();
 }