Beispiel #1
0
        public static GEDCOMRecordList CreateFamilyRecords()
        {
            var families = new GEDCOMRecordList();

            var family = CreateFamilyRecord(1);

            families.Add(family);

            family = CreateFamilyRecord(2);
            families.Add(family);

            return(families);
        }
Beispiel #2
0
        public static GEDCOMRecordList CreateIndividualRecords()
        {
            var individuals = new GEDCOMRecordList();

            var individual = CreateIndividualRecord(1);

            individuals.Add(individual);

            individual = CreateIndividualRecord(2);
            individuals.Add(individual);

            return(individuals);
        }
Beispiel #3
0
        /// <summary>
        ///   Adds a record to the GEDCOM Document
        /// </summary>
        /// <param name = "record">The record to add</param>
        public void AddRecord(GEDCOMRecord record)
        {
            Requires.NotNull("record", record);

            _records.Add(record);

            //clear the assoicated RecordList so it is refreshed next time around
            ClearList(record.TagName);
        }
        /// <summary>
        ///   Adds a record to the GEDCOM Document
        /// </summary>
        /// <param name = "record">The record to add</param>
        public void AddRecord(GEDCOMRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(typeof(GEDCOMRecord).Name);
            }

            _records.Add(record);

            //clear the assoicated RecordList so it is refreshed next time around
            ClearList(record.TagName);
        }
        /// <summary>
        ///   ReadRecords reads to the end of the source and return all the records
        ///   of a sepcified Tag type
        /// </summary>
        /// <returns>A List of GEDCOMRecords.</returns>
        private GEDCOMRecordList ReadRecords(GEDCOMTag tag)
        {
            GEDCOMRecord record;
            var          lines = new GEDCOMRecordList();

            while ((record = ReadRecord()) != null)
            {
                if (record.TagName == tag || tag == GEDCOMTag.ANY)
                {
                    lines.Add(record);
                }
            }

            return(lines);
        }
Beispiel #6
0
        public void GEDCOMDocument_AddRecords_Add_Records_To_Individuals_Collection(int recordCount)
        {
            //Arrange
            var document = new GEDCOMDocument();
            var records  = new GEDCOMRecordList();
            int count    = document.Records.Count;

            for (int i = 1; i <= recordCount; i++)
            {
                records.Add(Util.CreateIndividualRecord(i));
            }

            //Act
            document.AddRecords(records);

            //Assert
            Assert.AreEqual(count + recordCount, document.IndividualRecords.Count);
        }