|
|
|
@ -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<ParagraphsController>());
|
|
|
|
|
|
|
|
|
|
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<ParagraphsController>());
|
|
|
|
|
|
|
|
|
|
var paragraphsResult = ParagraphsController.DeleteParagraph(100);
|
|
|
|
|
if (paragraphsResult is NotFoundObjectResult NFObjectResult)
|
|
|
|
|
{
|
|
|
|
|
Assert.Null(NFObjectResult.Value);
|
|
|
|
|
Assert.IsNotType<bool>(NFObjectResult.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|