public void Download_ReturnsNotFound() { var webhost = new Mock <IWebHostEnvironment>(); var config = new Mock <IConfigParam>(); var fileservice = new Mock <IFileService>(); var controller = new FileAPI_OTP.Controllers.FileAPIController(webhost.Object, config.Object, fileservice.Object); Assert.IsType <NotFoundResult>(controller.Download("yyyyy.yxz")); }
public void Download_ReturnsOk() { var webhost = new Mock <IWebHostEnvironment>(); var config = new Mock <IConfigParam>(); var fileservice = new Mock <IFileService>(); var controller = new FileAPI_OTP.Controllers.FileAPIController(webhost.Object, config.Object, fileservice.Object); fileservice.Setup(m => m.GetFile("yyyyy.yxz")).Returns(() => new string("yyyyy.yxz")); Assert.IsType <OkObjectResult>(controller.Download("yyyyy.yxz")); }