44
55namespace Force . DeepCloner . Tests
66{
7+ #if ! NETCORE
78 [ TestFixture ( false ) ]
9+ #endif
810 [ TestFixture ( true ) ]
911 public class ConstructorsSpec : BaseTest
1012 {
@@ -64,6 +66,7 @@ public override string ToString()
6466 }
6567 }
6668
69+ #if ! NETCORE
6770 public class ClonableClass : ICloneable
6871 {
6972 public object X { get ; set ; }
@@ -74,6 +77,15 @@ public object Clone()
7477 }
7578 }
7679
80+ [ Test ]
81+ public void Cloner_Should_Not_Call_Any_Method_Of_Clonable_Class ( )
82+ {
83+ // just for check, ensure no hidden behaviour in MemberwiseClone
84+ Assert . DoesNotThrow ( ( ) => new ClonableClass ( ) . DeepClone ( ) ) ;
85+ Assert . DoesNotThrow ( ( ) => new { X = new ClonableClass ( ) } . DeepClone ( ) ) ;
86+ }
87+ #endif
88+
7789 [ Test ]
7890 public void Object_With_Private_Constructor_Should_Be_Cloned ( )
7991 {
@@ -103,6 +115,7 @@ public void Anonymous_Object_Should_Be_Cloned()
103115 Assert . That ( cloned . B , Is . EqualTo ( "x" ) ) ;
104116 }
105117
118+ #if ! NETCORE
106119 private class C3 : ContextBoundObject
107120 {
108121 }
@@ -128,6 +141,7 @@ public void MarshalByRef_Object_Should_Be_Cloned()
128141 var cloned = c . DeepClone ( ) ;
129142 Assert . That ( cloned , Is . Not . Null ) ;
130143 }
144+ #endif
131145
132146 [ Test ]
133147 public void Cloner_Should_Not_Call_Any_Method_Of_Class_Be_Cloned ( )
@@ -136,13 +150,5 @@ public void Cloner_Should_Not_Call_Any_Method_Of_Class_Be_Cloned()
136150 var exClass = new ExClass ( "x" ) ;
137151 Assert . DoesNotThrow ( ( ) => new [ ] { exClass , exClass } . DeepClone ( ) ) ;
138152 }
139-
140- [ Test ]
141- public void Cloner_Should_Not_Call_Any_Method_Of_Clonable_Class ( )
142- {
143- // just for check, ensure no hidden behaviour in MemberwiseClone
144- Assert . DoesNotThrow ( ( ) => new ClonableClass ( ) . DeepClone ( ) ) ;
145- Assert . DoesNotThrow ( ( ) => new { X = new ClonableClass ( ) } . DeepClone ( ) ) ;
146- }
147153 }
148154}
0 commit comments