public void Should_add_document_to_database() { var document = CreateDocument(); IDocumentsRepository documentsRepository = new NPocoDocumentsRepository(new JsonEditorDb()); var documentId = documentsRepository.Add(document); using (var db = new JsonEditorDb()) { var documentFromDb = db.FirstOrDefault<Document>(new Sql("SELECT * FROM Documents WHERE Id = @documentId", new { documentId })); documentFromDb.Id.Should().Be(documentId); } }
private void ClearDocumentsTable() { using (var db = new JsonEditorDb()) db.Execute(new Sql("TRUNCATE Documents;")); }