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