public void TestHasTuplesWrapped() { var model = RuntimeTypeModel.Create(); model.AutoCompile = false; var obj = new HasTuples { Value = new BasicTuple(123, "abc") }; CheckBytes(model, obj, "0A 07 08 7B 12 03 61 62 63", "runtime"); var clone = (HasTuples)model.DeepClone(obj); Assert.Equal(123, clone.Value.Foo); //, "runtime"); Assert.Equal("abc", clone.Value.Bar); //, "runtime"); model.Compile("TestHasTuplesWrapped", "TestHasTuplesWrapped.dll"); PEVerify.AssertValid("TestHasTuplesWrapped.dll"); model.CompileInPlace(); CheckBytes(model, obj, "0A 07 08 7B 12 03 61 62 63", "CompileInPlace"); clone = (HasTuples)model.DeepClone(obj); Assert.Equal(123, clone.Value.Foo); //, "CompileInPlace"); Assert.Equal("abc", clone.Value.Bar); //, "CompileInPlace"); var compiled = model.Compile(); CheckBytes(compiled, obj, "0A 07 08 7B 12 03 61 62 63", "Compile"); clone = (HasTuples)compiled.DeepClone(obj); Assert.Equal(123, clone.Value.Foo); //, "Compile"); Assert.Equal("abc", clone.Value.Bar); //, "Compile"); }
public void TestHasTuplesWrapped() { var model = RuntimeTypeModel.Create(); model.AutoCompile = false; var obj = new HasTuples {Value = new BasicTuple(123, "abc")}; CheckBytes(model, obj, "0A 07 08 7B 12 03 61 62 63", "runtime"); var clone = (HasTuples) model.DeepClone(obj); Assert.AreEqual(123, clone.Value.Foo, "runtime"); Assert.AreEqual("abc", clone.Value.Bar, "runtime"); model.Compile("TestHasTuplesWrapped", "TestHasTuplesWrapped.dll"); PEVerify.AssertValid("TestHasTuplesWrapped.dll"); model.CompileInPlace(); CheckBytes(model, obj, "0A 07 08 7B 12 03 61 62 63", "CompileInPlace"); clone = (HasTuples) model.DeepClone(obj); Assert.AreEqual(123, clone.Value.Foo, "CompileInPlace"); Assert.AreEqual("abc", clone.Value.Bar, "CompileInPlace"); var compiled = model.Compile(); CheckBytes(compiled, obj, "0A 07 08 7B 12 03 61 62 63", "Compile"); clone = (HasTuples)compiled.DeepClone(obj); Assert.AreEqual(123, clone.Value.Foo, "Compile"); Assert.AreEqual("abc", clone.Value.Bar, "Compile"); }