public void GedComComparison_GedcomFamilyLink_IsEquivalentTo_ExpectAreEqual()
        {
            // Arrange
            var object1 = new GedcomFamilyLink();
            var object2 = new GedcomFamilyLink();

            // Act and Assert
            Assert.True(object1.IsEquivalentTo(object2));
            Assert.True(object2.IsEquivalentTo(object1));
        }
Example #2
0
        private void Family_link_is_not_equal_to_null_test()
        {
            var familyLink = new GedcomFamilyLink();

            Assert.True(familyLink.CompareTo(null) == 1);
        }
Example #3
0
        private void AppendFamilyDetails(GedcomFamilyLink link, XmlNode root, int generation)
        {
            string famID = link.Family;

            if (!processed.Contains(famID))
            {
                processed.Add(famID);

                GedcomFamilyRecord fam = Database[famID] as GedcomFamilyRecord;

                if (fam != null)
                {
                    foreach (GedcomFamilyEvent famEvent in fam.Events)
                    {
                        famEvent.EventXRefID = Database.GenerateXref("EVENT");
                        AppendEvent(famEvent, root);

                        AppendSources(famEvent, root);
                    }

                    AppendFamily(fam, root);

                    if (!string.IsNullOrEmpty(fam.Husband))
                    {
                        GedcomIndividualRecord husb = Database[fam.Husband] as GedcomIndividualRecord;
                        if (husb != null)
                        {
                            AppendIndividualDetails(husb, root, generation);
                        }
                        else
                        {
                            throw new Exception("Husband points to non individual record");
                        }
                    }

                    if (!string.IsNullOrEmpty(fam.Wife))
                    {
                        GedcomIndividualRecord wife = Database[fam.Wife] as GedcomIndividualRecord;
                        if (wife != null)
                        {
                            AppendIndividualDetails(wife, root, generation);
                        }
                        else
                        {
                            throw new Exception("Husband points to non individual record");
                        }
                    }

                    foreach (string childID in fam.Children)
                    {
                        GedcomIndividualRecord child = Database[childID] as GedcomIndividualRecord;
                        if (child != null)
                        {
                            int childGeneration = generation - 1;
                            AppendIndividualDetails(child, root, childGeneration);
                        }
                        else
                        {
                            throw new Exception("Child points to non individual record");
                        }
                    }
                }
                else
                {
                    throw new Exception("Family link points to non family record");
                }
            }
        }