public void Test_Common()
        {
            GDMTree tree = new GDMTree();

            Assert.IsNotNull(tree);

            GDMIndividualRecord indiv = tree.CreateIndividual();

            Assert.IsNotNull(indiv);

            GDMFamilyRecord famRec = tree.CreateFamily();

            Assert.IsNotNull(famRec);

            famRec.Restriction = GDMRestriction.rnLocked;
            Assert.AreEqual(GDMRestriction.rnLocked, famRec.Restriction);

            famRec.AddChild(indiv);
            Assert.AreEqual(0, famRec.IndexOfChild(indiv));

            famRec.Husband.Value = tree.CreateIndividual();
            famRec.Wife.Value    = tree.CreateIndividual();

            using (GDMFamilyRecord fam2 = tree.CreateFamily()) {
                Assert.Throws(typeof(ArgumentException), () => {
                    fam2.Assign(null);
                });

                fam2.Assign(famRec);

                string buf = TestUtils.GetTagStreamText(fam2, 0);
                Assert.AreEqual("0 @F2@ FAM\r\n" +
                                "1 RESN locked\r\n" +
                                "1 HUSB @I2@\r\n" +
                                "1 WIFE @I3@\r\n" +
                                "1 CHIL @I1@\r\n", buf);
            }

            // Integrity test
            GDMChildToFamilyLink childLink = indiv.ChildToFamilyLinks[0];

            Assert.IsNotNull(childLink.Family);

            famRec.RemoveChild(indiv);
            Assert.AreEqual(-1, famRec.IndexOfChild(indiv));

            //

            Assert.Throws(typeof(ArgumentException), () => {
                famRec.AddEvent(new GDMIndividualEvent(null));
            });

            famRec.ReplaceXRefs(new GDMXRefReplacer());

            //

            famRec.Husband.Value = indiv;
            Assert.AreEqual(indiv, famRec.Husband.Individual);
            famRec.Husband.Value = null;

            //

            famRec.Wife.Value = indiv;
            Assert.AreEqual(indiv, famRec.Wife.Individual);
            famRec.Wife.Value = null;

            //

            indiv.Sex = GDMSex.svMale;
            famRec.AddSpouse(indiv);
            Assert.AreEqual(0, indiv.IndexOfSpouse(famRec));
            Test_GDMSpouseToFamilyLink(indiv.SpouseToFamilyLinks[0]);
            Assert.IsNull(famRec.GetSpouseBy(indiv));
            famRec.RemoveSpouse(indiv);

            indiv.Sex = GDMSex.svFemale;
            famRec.AddSpouse(indiv);
            Assert.AreEqual(0, indiv.IndexOfSpouse(famRec));
            Test_GDMSpouseToFamilyLink(indiv.SpouseToFamilyLinks[0]);
            Assert.IsNull(famRec.GetSpouseBy(indiv));
            famRec.RemoveSpouse(indiv);

            //

            famRec.SortChilds();

            //

            famRec.AddChild(null);
            famRec.RemoveChild(null);
            famRec.AddSpouse(null);
            famRec.RemoveSpouse(null);

            //
            famRec.AddSpouse(indiv);

            famRec.AddChild(tree.CreateIndividual());
            famRec.AddChild(tree.CreateIndividual());
            famRec.AddChild(tree.CreateIndividual());
            Assert.AreEqual(3, famRec.Children.Count);

            Assert.IsFalse(famRec.IsEmpty());
            famRec.Clear();
            Assert.IsTrue(famRec.IsEmpty());
        }