Fin des TU ParagraphController
continuous-integration/drone/push Build is passing Details

pull/40/head
Maxime SAPOUNTZIS 1 year ago
parent 4f3de6b3ab
commit 957e864770

@ -241,6 +241,46 @@ namespace TestAPI
} }
[Fact]
public void UpdateParagraphSuccess()
{
paragraphService.Setup(x => x.UpdateParagraph(1,new ParagraphDTO(1,"Le nouveau titre", "Le nouveau content", "Les infos", "La requête requêtante", "Commentaires", 2)))
.Returns(new ParagraphDTO(1, "Le nouveau titre", "Le nouveau content", "Les infos", "La requête requêtante", "Commentaires", 2));
var ParagraphsController = new ParagraphsController(paragraphService.Object, new NullLogger<ParagraphsController>());
var paragraphsResult = ParagraphsController.UpdateParagraph(1, new ParagraphDTO(1, "Le nouveau titre", "Le nouveau content", "Les infos", "La requête requêtante", "Commentaires", 2));
if (paragraphsResult is OkObjectResult okObjectResult)
{
ParagraphDTO valeur = okObjectResult.Value as ParagraphDTO;
Assert.NotNull(valeur);
Assert.Equal("Le nouveau titre", valeur.Title);
Assert.Equal("Le nouveau content", valeur.Content);
Assert.Equal("Les infos", valeur.Info);
Assert.Equal("La requête requêtante", valeur.Query);
Assert.Equal("Commentaires", valeur.Comment);
Assert.Equal(2, valeur.LessonId);
}
}
[Fact]
public void UpdateParagraphFail()
{
paragraphService.Setup(x => x.UpdateParagraph(1, new ParagraphDTO(1, "Le nouveau titre", "Le nouveau content", "Les infos", "La requête requêtante", "Commentaires", 2)))
.Returns(new ParagraphDTO(1, "Le nouveau titre", "Le nouveau content", "Les infos", "La requête requêtante", "Commentaires", 2));
var ParagraphsController = new ParagraphsController(paragraphService.Object, new NullLogger<ParagraphsController>());
var paragraphsResult = ParagraphsController.UpdateParagraph(1, new ParagraphDTO(2, "Le nouveau titre", "Le nouveau content", "Les infos", "La requête requêtante", "Commentaires", 2));
if (paragraphsResult is BadRequestResult BDObjectResult)
{
Assert.Equal(400, BDObjectResult.StatusCode);
}
}

@ -243,7 +243,7 @@ namespace TestAPI
[Fact] [Fact]
public void UpdateUserSuccess() public void UpdateSuccessSuccess()
{ {
successService.Setup(x => x.UpdateSuccess(1,1,new SuccessDTO(1,1,true))) successService.Setup(x => x.UpdateSuccess(1,1,new SuccessDTO(1,1,true)))
.Returns(new SuccessDTO(1, 1, true)); .Returns(new SuccessDTO(1, 1, true));
@ -263,7 +263,7 @@ namespace TestAPI
} }
[Fact] [Fact]
public void UpdateUserFail() public void UpdateSuccessFail()
{ {
successService.Setup(x => x.UpdateSuccess(1, 1, new SuccessDTO(1, 2, true))) successService.Setup(x => x.UpdateSuccess(1, 1, new SuccessDTO(1, 2, true)))
.Returns(new SuccessDTO(1, 2, true)); .Returns(new SuccessDTO(1, 2, true));

Loading…
Cancel
Save