예제 #1
0
        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"));
        }
예제 #2
0
        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"));
        }