public async Task DeleteDocument_DocumentNotExists_NoExceptionThrown() { // Arrange var db = new DocumentDb(location, key, database); var documentId = Guid.NewGuid().ToString(); // Act var ex = await Record.ExceptionAsync(() => db.DeleteDocument(CollectionId, documentId)); // Assert ex.Should().BeNull(); }
public async Task DeleteDocument_DocumentIdIsNull_ThrowsException(string documentId) { // Arrange var db = new DocumentDb(location, key, database); // Act var ex = await Record.ExceptionAsync(() => db.DeleteDocument(CollectionId, documentId)); //Assert ex.Should().NotBeNull(); ex.Should().BeOfType <ArgumentNullException>(); }
public async Task DeleteDocument_DocumentExists_DocumentIsDeleted() { // Arrange var db = new DocumentDb(location, key, database); 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(); }