diff --git a/API_SQLuedo/TestAPI/ParagraphsUnitTest.cs b/API_SQLuedo/TestAPI/ParagraphsUnitTest.cs index c1ca68c..73e22d1 100644 --- a/API_SQLuedo/TestAPI/ParagraphsUnitTest.cs +++ b/API_SQLuedo/TestAPI/ParagraphsUnitTest.cs @@ -167,6 +167,39 @@ namespace TestAPI } + [Fact] + public void DeleteParagraphSuccess() + { + paragraphService.Setup(x => x.DeleteParagraph(1)) + .Returns(true); + var ParagraphsController = new ParagraphsController(paragraphService.Object, new NullLogger()); + + var paragraphsResult = ParagraphsController.DeleteParagraph(1); + if (paragraphsResult is OkObjectResult okObjectResult) + { + bool valeur = (bool)okObjectResult.Value; + + Assert.True(valeur); + } + + } + + + [Fact] + public void DeleteParagraphFail() + { + paragraphService.Setup(x => x.DeleteParagraph(1)) + .Returns(true); + var ParagraphsController = new ParagraphsController(paragraphService.Object, new NullLogger()); + + var paragraphsResult = ParagraphsController.DeleteParagraph(100); + if (paragraphsResult is NotFoundObjectResult NFObjectResult) + { + Assert.Null(NFObjectResult.Value); + Assert.IsNotType(NFObjectResult.Value); + } + } +