diff --git a/API_SQLuedo/TestAPI/LessonUnitTest.cs b/API_SQLuedo/TestAPI/LessonUnitTest.cs index e368d50..c11aed1 100644 --- a/API_SQLuedo/TestAPI/LessonUnitTest.cs +++ b/API_SQLuedo/TestAPI/LessonUnitTest.cs @@ -161,8 +161,39 @@ namespace TestAPI } + [Fact] + public void DeleteLessonSuccess() + { + lessonService.Setup(x => x.DeleteLesson(1)) + .Returns(true); + var LessonsController = new LessonsController(lessonService.Object, new NullLogger()); + + var lessonsResult = LessonsController.DeleteLesson(1); + if (lessonsResult is OkObjectResult okObjectResult) + { + bool valeur = (bool)okObjectResult.Value; + + Assert.True(valeur); + } + + } + [Fact] + public void DeleteLessonFail() + { + lessonService.Setup(x => x.DeleteLesson(1)) + .Returns(true); + var LessonsController = new LessonsController(lessonService.Object, new NullLogger()); + + var lessonsResult = LessonsController.DeleteLesson(100); + if (lessonsResult is NotFoundObjectResult NFObjectResult) + { + Assert.Null(NFObjectResult.Value); + Assert.IsNotType(NFObjectResult.Value); + } + } +