Beispiel #1
0
        private void TestInnerScope(CSharpB b)
        {
            var a = new CSharpAwithDestructor();

            a.SetName("rar");
            b.SetA(a);
        }
Beispiel #2
0
 public void TestInheritedFunctionCallFromCpp()
 {
     var a = new CSharpA();
     var b = new CSharpB();
     a.SetName( "bob" );
     a.SayHello();
     b.SetA( a );
     Assert.AreEqual(  "C++ Call A:C# Hell!", b.CallA() );
 }
Beispiel #3
0
        public void TestInheritedFunctionCallFromCpp()
        {
            var a = new CSharpA();
            var b = new CSharpB();

            a.SetName("bob");
            a.SayHello();
            b.SetA(a);
            Assert.AreEqual("C++ Call A:C# Hell!", b.CallA());
        }
Beispiel #4
0
 void TestScope()
 {
     var b = new CSharpB();
     {
         TestInnerScope(b);
         ClearGC();
         Assert.AreEqual( "C++ Call A:C# Hell!", b.CallA() );
     }
     ClearGC();
     Assert.AreEqual( "C++ Call A:C# Hell!", b.CallA() ); // How to keep shared_ptr passed object as long as C++ needs it?
 }
Beispiel #5
0
        void TestScope()
        {
            var b = new CSharpB();

            {
                TestInnerScope(b);
                ClearGC();
                Assert.AreEqual("C++ Call A:C# Hell!", b.CallA());
            }
            ClearGC();
            Assert.AreEqual("C++ Call A:C# Hell!", b.CallA());   // How to keep shared_ptr passed object as long as C++ needs it?
        }
Beispiel #6
0
        public void TestWithUsing()
        {
            using ( var a = new CSharpAwithDestructor() ) {
            using ( var b = new CSharpB() ) {
                    a.SetName( "rar" );
                    b.SetA( a );

                    Assert.AreEqual( "C++ Call A:C# Hell!", b.CallA() );
                }
            }
            ClearGC();
            Assert.AreEqual( CSharpAwithDestructor.State.Destroyed, CSharpAwithDestructor.LastState );
        }
Beispiel #7
0
        public void TestWithUsing()
        {
            using (var a = new CSharpAwithDestructor()) {
                using (var b = new CSharpB()) {
                    a.SetName("rar");
                    b.SetA(a);

                    Assert.AreEqual("C++ Call A:C# Hell!", b.CallA());
                }
            }
            ClearGC();
            Assert.AreEqual(CSharpAwithDestructor.State.Destroyed, CSharpAwithDestructor.LastState);
        }
Beispiel #8
0
 private void TestInnerScope(CSharpB b)
 {
     var a = new CSharpAwithDestructor();
     a.SetName( "rar" );
     b.SetA( a );
 }