public void FullCycle_doc3()
        {
            var comparer = new DocLogicalComparer();

            var d1 = new Doc3
            {
                D1 = new Doc1 {
                    S1 = "asdf"
                },
                D2 = new Doc2()
                {
                    S1 = "in d1", B1 = true, I1 = 1234, DT1 = new DateTime(1980, 09, 15, 0, 0, 0, DateTimeKind.Utc), NI1 = null, NL1 = 9_000_000_000L, S2 = null, NDT1 = null
                }
            };

            var json = d1.ToJson(JsonWritingOptions.PrettyPrintRowsAsMap);

            var d2 = JsonReader.ToDoc <Doc3>(json);

            json.See("JSON");

            var diff = comparer.Compare(d1, d2);

            diff.See();
            Aver.IsTrue(diff.AreSame);
        }
        public void FullCycle_doc4()
        {
            var comparer = new DocLogicalComparer();

            var d1 = new Doc4
            {
                COL1 = new[] { null, null, new Doc1 {
                                   S1 = "asdf"
                               }, new Doc1 {
                                   S1 = "forgfoot"
                               }, new Doc1 {
                                   S1 = "eat borsch!"
                               } },
                COL2 = new[] { new Doc2()
Exemplo n.º 3
0
        public void Case10_logical_diff_withcollections_1_rank()
        {
            var d1 = new BBDoc
            {
                B          = 900,
                BB         = -800.123,
                Name       = "Saturn",
                ListOthers = new List <BaseDoc> {
                    new ADoc {
                        Name = "A0", A = 0
                    },
                    null,
                    new BDoc {
                        Name = "B2", B = 2
                    },
                    new BBDoc {
                        Name = "BB3", B = 3
                    },
                    null,
                    null,
                    new AADoc {
                        Name = "AA4", A = 4
                    }
                },
                ArrayOthers = new BaseDoc[] {
                    new AADoc {
                        Name = "A0", A = -9, AA = 12343.0123
                    },
                    null,
                    null,
                    new BDoc {
                        Name = "B2", B = 2
                    }
                }
            };

            var json = d1.ToJson();

            json.See();

            var got = JsonReader.ToDoc <BaseDoc>(json);//BB deser to BaseDoc

            var cmp = new DocLogicalComparer {
                LoopByA = true, LoopByB = true, LoopByAmorphous = false
            };
            var result = cmp.Compare(d1, got);

            Aver.IsTrue(result.AreSame);
        }
        public void TwoEmpty()
        {
            var comparer = new DocLogicalComparer();

            var d1 = new Doc1()
            {
            };
            var d2 = new Doc1()
            {
            };

            var diff = comparer.Compare(d1, d2);

            diff.See();
            Aver.IsTrue(diff.AreSame);
            Aver.IsFalse(diff.AreDifferent);
        }
        public void OneField_d2_Different()
        {
            var comparer = new DocLogicalComparer();

            var d1 = new Doc1()
            {
            };
            var d2 = new Doc1()
            {
                S1 = "abc"
            };

            var diff = comparer.Compare(d1, d2);

            diff.See();
            Aver.IsFalse(diff.AreSame);
            Aver.IsTrue(diff.AreDifferent);
        }
Exemplo n.º 6
0
        public void Case10_logical_diff_basic()
        {
            var d1 = new BBDoc
            {
                B    = 900,
                BB   = -800.123,
                Name = "Moon"
            };

            var json = d1.ToJson();

            json.See();

            var got = JsonReader.ToDoc <BaseDoc>(json);//BB deser to BaseDoc

            var cmp = new DocLogicalComparer {
                LoopByA = true, LoopByB = true, LoopByAmorphous = false
            };
            var result = cmp.Compare(d1, got);

            Aver.IsTrue(result.AreSame);
        }
        public void FullCycle_doc1()
        {
            var comparer = new DocLogicalComparer();

            var d1 = new Doc1()
            {
                S1 = "in d1"
            };

            var json = d1.ToJson(JsonWritingOptions.PrettyPrintRowsAsMap);

            var d2 = JsonReader.ToDoc <Doc1>(json);

            d1.See("d1");
            json.See("JSON");
            d2.See("d2");

            var diff = comparer.Compare(d1, d2);

            diff.See();
            Aver.IsTrue(diff.AreSame);
        }
Exemplo n.º 8
0
        public void Case11_logical_diff_withcollections_2_rank()
        {
            var d1 = new BBDoc
            {
                B          = 900,
                BB         = -800.123,
                Name       = "Saturn",
                ListOthers = new List <BaseDoc> {
                    new ADoc {
                        Name = "A0", A = 0, ArrayOthers = new BaseDoc[] { new ADoc {
                                                                              Name = "Elm1"
                                                                          }, null, null, new BDoc {
                                                                              Name = "Elm2"
                                                                          } }
                    },
                    null,
                    new BDoc {
                        Name = "B2", B = 2, ListOthers = new List <BaseDoc> {
                        }
                    },                                                    //empty list
                    new BBDoc {
                        Name = "BB3", B = 3
                    },
                    null,
                    new AADoc {
                        Name        = "AA4", A = 4,
                        ArrayOthers = new BaseDoc[] { new ADoc {
                                                          Name = "Elm1"
                                                      }, new BDoc {
                                                          Name = "Elm2"
                                                      } },
                        ListOthers = new List <BaseDoc> {
                            new BBDoc {
                                Name = "updown", BB = 345.1
                            }, new BDoc {
                                Name = "cu-cu", B = -546
                            }
                        }
                    },
                    null
                },
                ArrayOthers = new BaseDoc[] {
                    new AADoc {
                        Name = "A0", A = -9, AA = 12343.0123
                    },
                    null,
                    null,
                    new BDoc {
                        Name = "B2", B = 2, ListOthers = new List <BaseDoc> {
                            new ADoc {
                                Name = "23", A = 23
                            },
                            new ADoc {
                                Name = "24", A = 24
                            },
                            new BDoc {
                                Name       = "25", B = 25,
                                ListOthers = new List <BaseDoc> {
                                    new BBDoc {
                                        Name = "town-down", BB = -1000
                                    }
                                }
                            },
                        }
                    }
                }
            };

            var json = d1.ToJson();

            json.See();

            var got = JsonReader.ToDoc <BaseDoc>(json);//BB deser to BaseDoc


            got.See();

            var cmp = new DocLogicalComparer {
                LoopByA = true, LoopByB = true, LoopByAmorphous = false
            };
            var result = cmp.Compare(d1, got);

            Aver.IsTrue(result.AreSame);
        }