-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Copy pathMarshalByRefObjectTest.cs
32 lines (28 loc) · 1.05 KB
/
MarshalByRefObjectTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Reflection;
using Xunit;
namespace System.Tests
{
public class MarshalByRefObjectTest : MarshalByRefObject
{
[Fact]
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);
}
}
}