public async Task Document_Delete_Returns_Not_Found() { var repo = Substitute.For <IDocumentRepository>(); string reference = Guid.NewGuid().ToString(); repo.GetAsync(Arg.Any <Guid>()).Returns((Document)null); DocumentOrchestrator orchestrator = new DocumentOrchestrator(repo); await orchestrator.DeleteAsync(reference); IActionResult result = await orchestrator.DeleteAsync(reference); var typedResult = result as NotFoundResult; Assert.IsNotNull(typedResult); Assert.AreEqual(404, typedResult.StatusCode); }
public async Task Document_Delete() { var repo = Substitute.For <IDocumentRepository>(); Guid reference = Guid.NewGuid(); repo.GetAsync(Arg.Any <Guid>()).Returns(new Document() { Id = reference, }); DocumentOrchestrator orchestrator = new DocumentOrchestrator(repo); await orchestrator.DeleteAsync(reference.ToString()); await repo.Received(1).DeleteAsync(reference); }