public void TypeWithDictionaryTest() { var orig = new TypeWithDictionary { Data = new Dictionary <string, decimal> { { "abc", 123.45M } } }; var model = TypeModel.Create(); var clone = (TypeWithDictionary)model.DeepClone(orig); Assert.Single(clone.Data); Assert.Equal(123.45M, clone.Data["abc"]); //, "Runtime"); model.Compile("TypeWithDictionaryTest", "TypeWithDictionaryTest.dll"); PEVerify.Verify("TypeWithDictionaryTest.dll"); model.CompileInPlace(); clone = (TypeWithDictionary)model.DeepClone(orig); Assert.Single(clone.Data); Assert.Equal(123.45M, clone.Data["abc"]); //, "Runtime"); clone = (TypeWithDictionary)model.Compile().DeepClone(orig); Assert.Single(clone.Data); Assert.Equal(123.45M, clone.Data["abc"]); //, "Runtime"); }
public void ShouldWorkWithAutoLoadDisabledCompile() { var orig = new TypeWithDictionary { Data = new Dictionary<string, decimal> { { "abc", 123.45M } } }; var model = TypeModel.Create(); model.AutoAddMissingTypes = false; model.Add(typeof(TypeWithDictionary), true); var clone = (TypeWithDictionary)model.Compile().DeepClone(orig); Assert.AreEqual(1, clone.Data.Count); Assert.AreEqual(123.45M, clone.Data["abc"]); }
public void ShouldWorkWithAutoLoadDisabledAndAddedExplicitlyRuntime() { var orig = new TypeWithDictionary { Data = new Dictionary <string, decimal> { { "abc", 123.45M } } }; var model = TypeModel.Create(); model.AutoAddMissingTypes = false; model.Add(typeof(TypeWithDictionary), true); model.Add(typeof(KeyValuePair <string, decimal>), true); var clone = (TypeWithDictionary)model.DeepClone(orig); Assert.Single(clone.Data); Assert.Equal(123.45M, clone.Data["abc"]); }
public void ShouldWorkWithAutoLoadDisabledCompile() { var orig = new TypeWithDictionary { Data = new Dictionary <string, decimal> { { "abc", 123.45M } } }; var model = TypeModel.Create(); model.AutoAddMissingTypes = false; model.Add(typeof(TypeWithDictionary), true); var compiled = model.Compile("MapSerializer", "ShouldWorkWithAutoLoadDisabledCompile.dll"); PEVerify.Verify("ShouldWorkWithAutoLoadDisabledCompile.dll"); var clone = (TypeWithDictionary)model.Compile().DeepClone(orig); Assert.Single(clone.Data); Assert.Equal(123.45M, clone.Data["abc"]); }
public void TypeWithDictionaryTest() { var orig = new TypeWithDictionary { Data = new Dictionary<string, decimal> { { "abc", 123.45M } } }; var model = TypeModel.Create(); var clone = (TypeWithDictionary)model.DeepClone(orig); Assert.AreEqual(1, clone.Data.Count); Assert.AreEqual(123.45M, clone.Data["abc"], "Runtime"); model.Compile("TypeWithDictionaryTest", "TypeWithDictionaryTest.dll"); PEVerify.Verify("TypeWithDictionaryTest.dll"); model.CompileInPlace(); clone = (TypeWithDictionary)model.DeepClone(orig); Assert.AreEqual(1, clone.Data.Count); Assert.AreEqual(123.45M, clone.Data["abc"], "Runtime"); clone = (TypeWithDictionary)model.Compile().DeepClone(orig); Assert.AreEqual(1, clone.Data.Count); Assert.AreEqual(123.45M, clone.Data["abc"], "Runtime"); }