Ejemplo n.º 1
0
        static void Validate_Activation()
        {
            Console.WriteLine($"{nameof(Validate_Activation)}...");

            var test = new CoClass.ConsumeNETServerTesting();

            test.ReleaseResources();

            // The CoClass should be the activated type, _not_ the activation interface.
            Assert.AreEqual(test.GetType(), typeof(CoClass.ConsumeNETServerTestingClass));
        }
Ejemplo n.º 2
0
        static void Validate_CCW_Wasnt_Unwrapped()
        {
            Console.WriteLine($"{nameof(Validate_CCW_Wasnt_Unwrapped)}...");

            var test = new CoClass.ConsumeNETServerTesting();

            test.ReleaseResources();

            // The CoClass should be the activated type, _not_ the implementation class.
            // This indicates the real implementation class is wrapped in its CCW and exposed
            // to the runtime as an RCW.
            Assert.AreNotEqual(test.GetType(), typeof(ConsumeNETServerTesting));
        }
Ejemplo n.º 3
0
        static void Validate_Activation()
        {
            Console.WriteLine($"{nameof(Validate_Activation)}...");

            var test = new CoClass.ConsumeNETServerTesting();

            test.ReleaseResources();

            // The CoClass should be the activated type, _not_ the activation interface.
            Assert.Equal(test.GetType(), typeof(CoClass.ConsumeNETServerTestingClass));
            Assert.True(typeof(CoClass.ConsumeNETServerTestingClass).IsCOMObject);
            Assert.False(typeof(CoClass.ConsumeNETServerTesting).IsCOMObject);
            Assert.True(Marshal.IsComObject(test));
        }