public async Task DeleteDocument_DocumentExists_DocumentIsDeleted() { // Arrange var db = new MongoDb(ConnectionString, DatabaseId); var documentId = Guid.NewGuid().ToString(); var person = new PersonTest { PersonId = Guid.NewGuid(), Name = "Barney Rubble", Age = 87 }; var personEnvelope = new DocumentBase <PersonTest>() { VM = person }; await db.UpsertDocument(CollectionId, documentId, personEnvelope); // Act await db.DeleteDocument(CollectionId, documentId); var exists = db.DocumentExists(CollectionId, documentId); // Assert exists.Should().BeFalse(); }
public void IsDocumentInCollection_DocumentDoesNotExist_ReturnsFalse() { // Arrange var db = new MongoDb(ConnectionString, DatabaseId); var documentId = Guid.NewGuid().ToString(); // Act var exists = db.DocumentExists(CollectionId, documentId); // Assert exists.Should().BeFalse(); }
public void IsDocumentInCollection_DocumentIdIsNull_ThrowsException(string documentId) { // Arrange var db = new MongoDb(ConnectionString, DatabaseId); // Act var exception = Record.Exception(() => db.DocumentExists(CollectionId, documentId)); // Assert exception.Should().NotBeNull(); exception.Should().BeOfType <ArgumentNullException>(); }