コード例 #1
0
        public void TypeWithPairTest()
        {
            var orig = new TypeWithPair { Pair = new KeyValuePair<string, decimal>("abc", 123.45M) };
            var model = TypeModel.Create();
            var clone = (TypeWithPair)model.DeepClone(orig);
            Assert.AreEqual("abc", clone.Pair.Key, "Runtime");
            Assert.AreEqual(123.45M, clone.Pair.Value, "Runtime");

            model.Compile("TypeWithPairTest", "TypeWithPairTest.dll");
            PEVerify.Verify("TypeWithPairTest.dll");

            model.CompileInPlace();
            clone = (TypeWithPair)model.DeepClone(orig);
            Assert.AreEqual("abc", clone.Pair.Key, "CompileInPlace");
            Assert.AreEqual(123.45M, clone.Pair.Value, "CompileInPlace");

            clone = (TypeWithPair)model.Compile().DeepClone(orig);
            Assert.AreEqual("abc", clone.Pair.Key, "Compile");
            Assert.AreEqual(123.45M, clone.Pair.Value, "Compile");
        }
コード例 #2
0
ファイル: KeyValuePairTests.cs プロジェクト: cash2one/HBNews
        public void TypeWithPairTest()
        {
            var orig = new TypeWithPair { Pair = new KeyValuePair<string, decimal>("abc", 123.45M) };
            var model = TypeModel.Create();
            var clone = (TypeWithPair)model.DeepClone(orig);
            Assert.AreEqual("abc", clone.Pair.Key, "Runtime");
            Assert.AreEqual(123.45M, clone.Pair.Value, "Runtime");

            model.Compile("TypeWithPairTest", "TypeWithPairTest.dll");
            PEVerify.Verify("TypeWithPairTest.dll");

            model.CompileInPlace();
            clone = (TypeWithPair)model.DeepClone(orig);
            Assert.AreEqual("abc", clone.Pair.Key, "CompileInPlace");
            Assert.AreEqual(123.45M, clone.Pair.Value, "CompileInPlace");

            clone = (TypeWithPair)model.Compile().DeepClone(orig);
            Assert.AreEqual("abc", clone.Pair.Key, "Compile");
            Assert.AreEqual(123.45M, clone.Pair.Value, "Compile");
        }