Inheritance: System.MarshalByRefObject
示例#1
0
 public static void MarshalByRefObjectTests()
 {
     var obj = new MarshalByRefObjectTest();
     Assert.Throws<PlatformNotSupportedException>(() => obj.GetLifetimeService());
     Assert.Throws<PlatformNotSupportedException>(() => obj.InitializeLifetimeService());
     
     var clone = obj.MemberwiseClone(false);
     Assert.NotNull(clone);
     Assert.NotSame(clone, obj);
     
     var clone1 = obj.MemberwiseClone(false);
     Assert.NotNull(clone1);
     Assert.NotSame(clone1, obj);
     Assert.NotSame(clone1, clone);
 }
示例#2
0
        public static void MarshalByRefObjectTests()
        {
            var obj = new MarshalByRefObjectTest();

            Assert.Throws <PlatformNotSupportedException>(() => obj.GetLifetimeService());
            Assert.Throws <PlatformNotSupportedException>(() => obj.InitializeLifetimeService());

            var clone = obj.MemberwiseClone(false);

            Assert.NotNull(clone);
            Assert.NotSame(clone, obj);

            var clone1 = obj.MemberwiseClone(false);

            Assert.NotNull(clone1);
            Assert.NotSame(clone1, obj);
            Assert.NotSame(clone1, clone);
        }
        public static void MarshalByRefObjectTests()
        {
            var obj = new MarshalByRefObjectTest();

#pragma warning disable SYSLIB0010 // Obsolete: Remoting APIs
            Assert.Throws <PlatformNotSupportedException>(() => obj.GetLifetimeService());
            Assert.Throws <PlatformNotSupportedException>(() => obj.InitializeLifetimeService());
#pragma warning restore SYSLIB0010 // Obsolete: Remoting APIs

            var clone = obj.MemberwiseClone(false);
            Assert.NotNull(clone);
            Assert.NotSame(clone, obj);

            var clone1 = obj.MemberwiseClone(false);
            Assert.NotNull(clone1);
            Assert.NotSame(clone1, obj);
            Assert.NotSame(clone1, clone);
        }