public void TestAllFields()
        {
            ImplicitFieldPOCO foo = new ImplicitFieldPOCO
            {
                D_public           = 100,
                E_private          = 101,
                F_ignoreDirect     = 102,
                G_ignoreIndirect   = 103,
                H_nonSerialized    = 104,
                X_explicitField    = 105,
                Z_explicitProperty = 106
            };

            Assert.Equal(100, foo.D_public);           //, "D: pre");
            Assert.Equal(101, foo.E_private);          //, "E: pre");
            Assert.Equal(102, foo.F_ignoreDirect);     //, "F: pre");
            Assert.Equal(103, foo.G_ignoreIndirect);   //, "G: pre");
            Assert.Equal(104, foo.H_nonSerialized);    //, "H: pre");
            Assert.Equal(105, foo.X_explicitField);    //, "X: pre");
            Assert.Equal(106, foo.Z_explicitProperty); //, "Z: pre");

            ImplicitFieldPOCO bar = Serializer.DeepClone(foo);

            Assert.Equal(100, bar.D_public);       //, "D: post");
            Assert.Equal(101, bar.E_private);      //, "E: post");
            Assert.Equal(0, bar.F_ignoreDirect);   //, "F: post");
            Assert.Equal(0, bar.G_ignoreIndirect); //, "G: post");
//#if COREFX
//            Assert.Equal(104, bar.H_nonSerialized); //, "H: post");
//#else
            Assert.Equal(0, bar.H_nonSerialized);      //, "H: post");
//#endif
            Assert.Equal(105, bar.X_explicitField);    //, "X: post");
            Assert.Equal(106, bar.Z_explicitProperty); //, "Z: post");

            ImplicitFieldPOCOEquiv equiv = Serializer.ChangeType <ImplicitFieldPOCO, ImplicitFieldPOCOEquiv>(foo);

//#if COREFX // change in H being serialized/not moves everything around
//            Assert.Equal(100, equiv.D); //, "D: equiv");
//            Assert.Equal(104, equiv.E); //, "E: equiv");
//            Assert.Equal(105, equiv.X); //, "X: equiv");
//            Assert.Equal(106, equiv.Z); //, "Z: equiv");
//#else
            Assert.Equal(100, equiv.D); //, "D: equiv");
            Assert.Equal(101, equiv.E); //, "E: equiv");
            Assert.Equal(105, equiv.X); //, "X: equiv");
            Assert.Equal(106, equiv.Z); //, "Z: equiv");
//#endif
        }
示例#2
0
        public void TestAllFields()
        {
            ImplicitFieldPOCO foo = new ImplicitFieldPOCO
            {
                D_public           = 100,
                E_private          = 101,
                F_ignoreDirect     = 102,
                G_ignoreIndirect   = 103,
                H_nonSerialized    = 104,
                X_explicitField    = 105,
                Z_explicitProperty = 106
            };

            Assert.AreEqual(100, foo.D_public, "D: pre");
            Assert.AreEqual(101, foo.E_private, "E: pre");
            Assert.AreEqual(102, foo.F_ignoreDirect, "F: pre");
            Assert.AreEqual(103, foo.G_ignoreIndirect, "G: pre");
            Assert.AreEqual(104, foo.H_nonSerialized, "H: pre");
            Assert.AreEqual(105, foo.X_explicitField, "X: pre");
            Assert.AreEqual(106, foo.Z_explicitProperty, "Z: pre");

            var s = TypeModel.Create();

            s.SkipCompiledVsNotCheck = true;
            ImplicitFieldPOCO bar = s.DeepClone(foo);

            Assert.AreEqual(100, bar.D_public, "D: post");
            Assert.AreEqual(101, bar.E_private, "E: post");
            Assert.AreEqual(0, bar.F_ignoreDirect, "F: post");
            Assert.AreEqual(0, bar.G_ignoreIndirect, "G: post");
            Assert.AreEqual(0, bar.H_nonSerialized, "H: post");
            Assert.AreEqual(105, bar.X_explicitField, "X: post");
            Assert.AreEqual(106, bar.Z_explicitProperty, "Z: post");

            var proto1 = s.GetDebugSchema(typeof(ImplicitFieldPOCO));
            var proto2 = s.GetDebugSchema(typeof(ImplicitFieldPOCOEquiv));

            ImplicitFieldPOCOEquiv equiv = s.ChangeType <ImplicitFieldPOCO, ImplicitFieldPOCOEquiv>(foo);

            Assert.AreEqual(100, equiv.D, "D: equiv");
            Assert.AreEqual(101, equiv.E, "E: equiv");
            Assert.AreEqual(105, equiv.X, "X: equiv");
            Assert.AreEqual(106, equiv.Z, "Z: equiv");
        }
示例#3
0
        public void TestAllFields()
        {
            ImplicitFieldPOCO foo = new ImplicitFieldPOCO
            {
                D_public           = 100,
                E_private          = 101,
                F_ignoreDirect     = 102,
                G_ignoreIndirect   = 103,
                H_nonSerialized    = 104,
                X_explicitField    = 105,
                Z_explicitProperty = 106
            };

            Assert.AreEqual(100, foo.D_public, "D: pre");
            Assert.AreEqual(101, foo.E_private, "E: pre");
            Assert.AreEqual(102, foo.F_ignoreDirect, "F: pre");
            Assert.AreEqual(103, foo.G_ignoreIndirect, "G: pre");
            Assert.AreEqual(104, foo.H_nonSerialized, "H: pre");
            Assert.AreEqual(105, foo.X_explicitField, "X: pre");
            Assert.AreEqual(106, foo.Z_explicitProperty, "Z: pre");

            ImplicitFieldPOCO bar = Serializer.DeepClone(foo);

            Assert.AreEqual(100, bar.D_public, "D: post");
            Assert.AreEqual(101, bar.E_private, "E: post");
            Assert.AreEqual(0, bar.F_ignoreDirect, "F: post");
            Assert.AreEqual(0, bar.G_ignoreIndirect, "G: post");
            Assert.AreEqual(0, bar.H_nonSerialized, "H: post");
            Assert.AreEqual(105, bar.X_explicitField, "X: post");
            Assert.AreEqual(106, bar.Z_explicitProperty, "Z: post");

            ImplicitFieldPOCOEquiv equiv = Serializer.ChangeType <ImplicitFieldPOCO, ImplicitFieldPOCOEquiv>(foo);

            Assert.AreEqual(100, equiv.D, "D: equiv");
            Assert.AreEqual(101, equiv.E, "E: equiv");
            Assert.AreEqual(105, equiv.X, "X: equiv");
            Assert.AreEqual(106, equiv.Z, "Z: equiv");
        }
示例#4
0
        public void TestAllFields()
        {
            ImplicitFieldPOCO foo = new ImplicitFieldPOCO
                                    {
                                        D_public = 100,
                                        E_private = 101,
                                        F_ignoreDirect = 102,
                                        G_ignoreIndirect = 103,
                                        H_nonSerialized = 104,
                                        X_explicitField = 105,
                                        Z_explicitProperty = 106

                                    };
            Assert.AreEqual(100, foo.D_public, "D: pre");
            Assert.AreEqual(101, foo.E_private, "E: pre");
            Assert.AreEqual(102, foo.F_ignoreDirect, "F: pre");
            Assert.AreEqual(103, foo.G_ignoreIndirect, "G: pre");
            Assert.AreEqual(104, foo.H_nonSerialized, "H: pre");
            Assert.AreEqual(105, foo.X_explicitField, "X: pre");
            Assert.AreEqual(106, foo.Z_explicitProperty, "Z: pre");

            ImplicitFieldPOCO bar = Serializer.DeepClone(foo);
            Assert.AreEqual(100, bar.D_public, "D: post");
            Assert.AreEqual(101, bar.E_private, "E: post");
            Assert.AreEqual(0, bar.F_ignoreDirect, "F: post");
            Assert.AreEqual(0, bar.G_ignoreIndirect, "G: post");
            Assert.AreEqual(0, bar.H_nonSerialized, "H: post");
            Assert.AreEqual(105, bar.X_explicitField, "X: post");
            Assert.AreEqual(106, bar.Z_explicitProperty, "Z: post");

            ImplicitFieldPOCOEquiv equiv = Serializer.ChangeType<ImplicitFieldPOCO, ImplicitFieldPOCOEquiv>(foo);
            Assert.AreEqual(100, equiv.D, "D: equiv");
            Assert.AreEqual(101, equiv.E, "E: equiv");
            Assert.AreEqual(105, equiv.X, "X: equiv");
            Assert.AreEqual(106, equiv.Z, "Z: equiv");


        }