public static void ShallowStructTest() { Random rnd = new Random(); DummyClasses.SomeStruct a = new DummyClasses.SomeStruct() { Value = 42, Random = rnd, }; DummyClasses.SomeStruct b = a.Copy(false); AssertThat(b).IsSameAs(a); AssertThat(b.Value).IsEqualTo(a.Value); AssertThat(b.Random).IsSameAs(a.Random); }
public static void DeepStructTest() { Random rnd = new Random(); DummyClasses.SomeStruct a = new DummyClasses.SomeStruct() { Value = 42, Random = rnd, }; DummyClasses.SomeStruct b = a.Copy(true); AssertThat(b).IsNotSameAs(a); AssertThat(b.Value).IsEqualTo(a.Value); AssertThat(b.Random).IsNotSameAs(a.Random); AssertThat(b.Random.Next()).IsEqualTo(a.Random.Next()); }