Exemple #1
0
        public void Store()
        {
            const string DB_TEST_PATH = "sampledb_store";

            if (Directory.Exists(DB_TEST_PATH))
            {
                Directory.Delete(DB_TEST_PATH, true);
            }
            Directory.CreateDirectory(DB_TEST_PATH);

            var sut        = new FlashcardboxDb(DB_TEST_PATH);
            var flashcards = new[] {
                new FlashcardRecord {
                    Question = "q1", Answer = "a1", Tags = "t1", BinIndex = "1", Id = "1"
                },
                new FlashcardRecord {
                    Question = "q2.1\nq2.2", Answer = "a2.1\na2.2", Tags = "t2,t3", BinIndex = "", Id = ""
                }
            };


            sut.StoreFlashcards(flashcards);

            var result = sut.LoadFlashcards();

            result.Should().BeEquivalentTo(flashcards);
        }
Exemple #2
0
        IEnumerable <Event> Sync_flashcards(SyncContextModel model)
        {
            var flashcards = _db.LoadFlashcards().ToArray();

            var events0 = Sync_new_and_changed_flashcards(model, flashcards);
            var events1 = Sync_deleted_flashcards(model, flashcards);

            _db.StoreFlashcards(flashcards);

            return(events0.Concat(events1));
        }