|
|
@ -193,21 +193,22 @@ public class ParagraphsUnitTest
|
|
|
|
[Fact]
|
|
|
|
[Fact]
|
|
|
|
public void CreateParagraphSuccess()
|
|
|
|
public void CreateParagraphSuccess()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_paragraphService.Setup(x => x.CreateParagraph("Le nouveau titre", "Le nouveau content", "Les infos",
|
|
|
|
_paragraphService.Setup(x => x.CreateParagraph("Le nouveau titre", "Le nouveau content", "Title","Le nouveau content","Les infos",
|
|
|
|
"La requête requêtante", "Commentaires", 2))
|
|
|
|
"La requête requêtante", "Commentaires", 2))
|
|
|
|
.Returns(new ParagraphDto("Le nouveau titre", "Le nouveau content", "Les infos", "La requête requêtante",
|
|
|
|
.Returns(new ParagraphDto("Le nouveau titre", "Le nouveau content","Title", "Le nouveau content", "Les infos", "La requête requêtante",
|
|
|
|
"Commentaires", 2));
|
|
|
|
"Commentaires", 2));
|
|
|
|
var paragraphsController =
|
|
|
|
var paragraphsController =
|
|
|
|
new ParagraphsController(_paragraphService.Object, new NullLogger<ParagraphsController>());
|
|
|
|
new ParagraphsController(_paragraphService.Object, new NullLogger<ParagraphsController>());
|
|
|
|
|
|
|
|
|
|
|
|
var paragraphsResult = paragraphsController.CreateParagraph(new ParagraphDto("Le nouveau titre",
|
|
|
|
var paragraphsResult = paragraphsController.CreateParagraph(new ParagraphDto("Le nouveau titre", "Le nouveau content","Title",
|
|
|
|
"Le nouveau content", "Les infos", "La requête requêtante", "Commentaires", 2));
|
|
|
|
"Le nouveau content", "Les infos", "La requête requêtante", "Commentaires", 2));
|
|
|
|
if (paragraphsResult is CreatedResult createdObjectResult)
|
|
|
|
if (paragraphsResult is CreatedResult createdObjectResult)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ParagraphDto valeur = createdObjectResult.Value as ParagraphDto;
|
|
|
|
ParagraphDto valeur = createdObjectResult.Value as ParagraphDto;
|
|
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(valeur);
|
|
|
|
Assert.NotNull(valeur);
|
|
|
|
Assert.Equal("Le nouveau titre", valeur.Title);
|
|
|
|
Assert.Equal("Title", valeur.Title);
|
|
|
|
|
|
|
|
Assert.Equal("Le nouveau titre", valeur.ContentTitle);
|
|
|
|
|
|
|
|
Assert.Equal("Le nouveau content", valeur.ContentContent);
|
|
|
|
Assert.Equal("Le nouveau content", valeur.Content);
|
|
|
|
Assert.Equal("Le nouveau content", valeur.Content);
|
|
|
|
Assert.Equal("Les infos", valeur.Info);
|
|
|
|
Assert.Equal("Les infos", valeur.Info);
|
|
|
|
Assert.Equal("La requête requêtante", valeur.Query);
|
|
|
|
Assert.Equal("La requête requêtante", valeur.Query);
|
|
|
@ -219,8 +220,8 @@ public class ParagraphsUnitTest
|
|
|
|
[Fact]
|
|
|
|
[Fact]
|
|
|
|
public void CreateParagraphFail()
|
|
|
|
public void CreateParagraphFail()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_paragraphService.Setup(x => x.CreateParagraph("Le nouveau titre", "Le nouveau content", "Les infos",
|
|
|
|
_paragraphService.Setup(x => x.CreateParagraph("Le nouveau titre", "Le nouveau content", "Title","Les infos",
|
|
|
|
"La requête requêtante", "Commentaires", 2))
|
|
|
|
"La requête requêtante", "Commentaires", "Comment", 2))
|
|
|
|
.Returns(new ParagraphDto("Le nouveau titre", "Le nouveau content", "Les infos", "La requête requêtante",
|
|
|
|
.Returns(new ParagraphDto("Le nouveau titre", "Le nouveau content", "Les infos", "La requête requêtante",
|
|
|
|
"Commentaires", 2));
|
|
|
|
"Commentaires", 2));
|
|
|
|
var paragraphsController =
|
|
|
|
var paragraphsController =
|
|
|
|