Skip to content

Commit f3126b6

Browse files
committed
Add test for MemberwiseClone
1 parent 191432e commit f3126b6

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

src/NHibernate.Test/NHSpecificTest/ProxyValidator/ShouldBeProxiableTests.cs

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@ protected internal void AProtectedInternal() { }
4646
}
4747

4848
[Test]
49-
public void GetTypeShouldNotBeProxiable()
49+
public void ObjectToStringShouldBeProxiable()
5050
{
51-
var method = typeof(object).GetMethod(nameof(GetType));
51+
var method = typeof(object).GetMethod(nameof(ToString));
5252
Assert.Multiple(
5353
() =>
5454
{
55-
Assert.That(method.ShouldBeProxiable(), Is.False);
56-
Assert.That(method.IsProxiable(), Is.False);
55+
Assert.That(method.ShouldBeProxiable(), Is.True);
56+
Assert.That(method.IsProxiable(), Is.True);
5757
});
5858
}
5959

6060
[Test]
61-
public void ToStringShouldBeProxiable()
61+
public void ObjectGetHashCodeShouldBeProxiable()
6262
{
63-
var method = typeof(object).GetMethod(nameof(ToString));
63+
var method = typeof(object).GetMethod(nameof(GetHashCode));
6464
Assert.Multiple(
6565
() =>
6666
{
@@ -70,9 +70,9 @@ public void ToStringShouldBeProxiable()
7070
}
7171

7272
[Test]
73-
public void GetHashCodeShouldBeProxiable()
73+
public void ObjectEqualsShouldBeProxiable()
7474
{
75-
var method = typeof(object).GetMethod(nameof(GetHashCode));
75+
var method = typeof(object).GetMethod(nameof(Equals), BindingFlags.Public | BindingFlags.Instance);
7676
Assert.Multiple(
7777
() =>
7878
{
@@ -82,19 +82,34 @@ public void GetHashCodeShouldBeProxiable()
8282
}
8383

8484
[Test]
85-
public void EqualsShouldBeProxiable()
85+
public void ObjectMemberwiseCloneShouldNotBeProxiable()
8686
{
87-
var method = typeof(object).GetMethod(nameof(Equals), BindingFlags.Public | BindingFlags.Instance);
87+
var method = typeof(object).GetMethod(
88+
nameof(MemberwiseClone),
89+
BindingFlags.Instance | BindingFlags.NonPublic);
90+
8891
Assert.Multiple(
8992
() =>
9093
{
91-
Assert.That(method.ShouldBeProxiable(), Is.True);
92-
Assert.That(method.IsProxiable(), Is.True);
94+
Assert.That(method.ShouldBeProxiable(), Is.False);
95+
Assert.That(method.IsProxiable(), Is.False);
96+
});
97+
}
98+
99+
[Test]
100+
public void ObjectGetTypeShouldNotBeProxiable()
101+
{
102+
var method = typeof(object).GetMethod(nameof(GetType));
103+
Assert.Multiple(
104+
() =>
105+
{
106+
Assert.That(method.ShouldBeProxiable(), Is.False);
107+
Assert.That(method.IsProxiable(), Is.False);
93108
});
94109
}
95110

96111
[Test]
97-
public void DisposeNotBeProxiable()
112+
public void MyClassDisposeNotBeProxiable()
98113
{
99114
var method = typeof(MyClass).GetMethod("Dispose");
100115
Assert.Multiple(

0 commit comments

Comments
 (0)