Beispiel #1
0
        private void Gedcom_headers_are_equal_after_rewriting(string sourceFile)
        {
            var originalReader = GedcomRecordReader.CreateReader(sourceFile);
            var rewrittenPath  = sourceFile + ".rewritten";

            GedcomRecordWriter.OutputGedcom(originalReader.Database, rewrittenPath);

            var rewrittenReader = GedcomRecordReader.CreateReader(rewrittenPath);

            Assert.Equal(originalReader.Database.Header, rewrittenReader.Database.Header);
        }
        private List <GedcomIndividualRecord> RewrittenFile()
        {
            var sourceFile     = ".\\Data\\name.ged";
            var originalReader = GedcomRecordReader.CreateReader(sourceFile);
            var rewrittenPath  = sourceFile + ".rewritten";

            GedcomRecordWriter.OutputGedcom(originalReader.Database, rewrittenPath);

            var reader = GedcomRecordReader.CreateReader(rewrittenPath);

            return(reader.Database.Individuals);
        }
        private void Individuals_are_equal_after_rewriting(string sourceFile)
        {
            var originalReader = GedcomRecordReader.CreateReader(sourceFile);
            var rewrittenPath  = sourceFile + ".rewritten";

            GedcomRecordWriter.OutputGedcom(originalReader.Database, rewrittenPath);

            var rewrittenReader = GedcomRecordReader.CreateReader(rewrittenPath);

            AttachFileContentsToTest(sourceFile, rewrittenPath);
            Assert.True(GedcomGenericListComparer.CompareGedcomRecordLists(originalReader.Database.Individuals, rewrittenReader.Database.Individuals));
        }
        private void Gedcom_databases_are_equal_after_rewriting(string sourceFile)
        {
            var originalReader = GedcomRecordReader.CreateReader(sourceFile);
            var rewrittenPath  = sourceFile + ".rewritten";

            GedcomRecordWriter.OutputGedcom(originalReader.Database, rewrittenPath);

            var rewrittenReader = GedcomRecordReader.CreateReader(rewrittenPath);

            AttachFileContentsToTest(sourceFile, rewrittenPath);
            Assert.Equal(originalReader.Database, rewrittenReader.Database);
        }
Beispiel #5
0
        private void Gedcom_headers_are_equal_after_rewriting(string sourceFile)
        {
            var originalReader = GedcomRecordReader.CreateReader(sourceFile);
            var rewrittenPath  = $"{sourceFile}-{System.Guid.NewGuid()}.rewritten";

            GedcomRecordWriter.OutputGedcom(originalReader.Database, rewrittenPath);

            var rewrittenReader = GedcomRecordReader.CreateReader(rewrittenPath);

            AttachFileContentsToTest(sourceFile, rewrittenPath);
            Assert.Equal(originalReader.Database.Header, rewrittenReader.Database.Header);
        }
        /// <summary>
        /// Helper method to output a standard GEDCOM file without needing to create a writer.
        /// </summary>
        /// <param name="database">The database to output.</param>
        /// <param name="stream">The stream to write to.</param>
        public static void OutputGedcom(GedcomDatabase database, Stream stream)
        {
            var writer = new GedcomRecordWriter();

            writer.WriteGedcom(database, stream);
        }
        /// <summary>
        /// Helper method to output a standard GEDCOM file without needing to create a writer.
        /// </summary>
        /// <param name="database">The database to output.</param>
        /// <param name="file">The file path to output to.</param>
        public static void OutputGedcom(GedcomDatabase database, string file)
        {
            var writer = new GedcomRecordWriter();

            writer.WriteGedcom(database, file);
        }