Пример #1
0
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            //ViewResult result = controller.Index() as ViewResult;
            ViewResult result = controller.Index();

            // Assert
            Assert.IsNotNull(result);
        }
Пример #2
0
        public void Upload()
        {
            // Arrange
            HomeController controller = new HomeController();
            var httpContextMock = new Mock<HttpContextBase>();
            controller.ControllerContext = new ControllerContext(httpContextMock.Object, new RouteData(), controller);
            var FileUpload = new Mock<HttpPostedFileBase>();
            FileUpload.Setup(f => f.ContentLength).Returns(1);
            FileUpload.Setup(f => f.FileName).Returns("idsm_forupload.csv");

            // Act/
            ActionResult result = controller.Upload(FileUpload.Object);

            // Assert
            Assert.IsInstanceOf<ActionResult>(result);
        }