Exemplo n.º 1
0
        public void AllShouldReturnNotFoundWithIdLessOrEqualToOne()
        {
            var rigsService = new Mock <IRigsService>();

            var controller = new RigsController(rigsService.Object);

            Assert.IsType <NotFoundResult>(controller.All(0));

            Assert.IsType <NotFoundResult>(controller.All(-1));
        }
Exemplo n.º 2
0
        public void AllShouldReturnCorrectViewModel()
        {
            var rigsService = new Mock <IRigsService>();

            rigsService
            .Setup(t => t.GetAll <AddRigInputModel>(1, 6))
            .Returns(new List <AddRigInputModel>());

            var controller = new RigsController(rigsService.Object);

            var result = controller.All();

            Assert.IsType <ViewResult>(result);

            var viewResult = result as ViewResult;

            Assert.IsType <RigsListViewModel>(viewResult.Model);

            var viewModel = viewResult.Model as RigsListViewModel;

            Assert.Empty(viewModel.Rigs);
        }