public void TestImport1() { const int numRecords = 100; var file1 = CreateMockBackup(numRecords); var notes = CreateMockBibleNotes().ToArray(); var mockImportOptions = new ImportBibleNotesParams(); const int mepsLanguageId = 0; var importer = new NotesImporter( file1.Database, "nwtsty", mepsLanguageId, mockImportOptions); var result = importer.Import(notes); file1.Database.CheckValidity(); Assert.AreEqual(notes.Length, result.BibleNotesAdded); Assert.IsTrue(result.BibleNotesUnchanged == 0); Assert.IsTrue(result.BibleNotesUpdated == 0); result = importer.Import(notes); Assert.AreEqual(notes.Length, result.BibleNotesUnchanged); Assert.IsTrue(result.BibleNotesAdded == 0); Assert.IsTrue(result.BibleNotesUpdated == 0); }
/// <inheritdoc /> public BackupFile ImportBibleNotes( BackupFile originalBackupFile, IEnumerable <BibleNote> notes, string bibleKeySymbol, int mepsLanguageId, ImportBibleNotesParams options) { if (originalBackupFile == null) { throw new ArgumentNullException(nameof(originalBackupFile)); } if (notes == null) { throw new ArgumentNullException(nameof(notes)); } ProgressMessage("Importing Bible notes"); var newManifest = UpdateManifest(originalBackupFile.Manifest); var notesImporter = new NotesImporter( originalBackupFile.Database, bibleKeySymbol, mepsLanguageId, options); notesImporter.Import(notes); return(new BackupFile { Manifest = newManifest, Database = originalBackupFile.Database }); }
/// <inheritdoc /> public BackupFile ImportBibleNotes( BackupFile originalBackupFile, IEnumerable <BibleNote> notes, string bibleKeySymbol, int mepsLanguageId) { ProgressMessage("Importing Bible notes"); var newManifest = UpdateManifest(originalBackupFile.Manifest); var notesImporter = new NotesImporter(originalBackupFile.Database, bibleKeySymbol, mepsLanguageId); notesImporter.Import(notes); return(new BackupFile { Manifest = newManifest, Database = originalBackupFile.Database }); }