コード例 #1
0
        public void NavBar_Return_IsNotNullModel()
        {
            //Arrange
            var    navbar     = new NavbarController();
            string controller = "Home";
            string act        = "Index";

            //Act
            var result = navbar.Navbar(controller, act) as PartialViewResult;

            //Assert
            Assert.IsNotNull(result);
        }
コード例 #2
0
        public void NavBar_Return_TypeModel()
        {
            //Arrange
            var    navbar     = new NavbarController();
            string controller = "Home";
            string act        = "Index";

            //Act
            var result = navbar.Navbar(controller, act) as PartialViewResult;

            //Assert
            Assert.IsInstanceOfType(result.Model, typeof(List <Navbar>));
        }
コード例 #3
0
        public void NavBar_Return_ViewResult()
        {
            //Arrange
            var    navbar     = new NavbarController();
            string controller = "Home";
            string act        = "Index";

            //Act
            var result = navbar.Navbar(controller, act);

            //Assert
            Assert.IsInstanceOfType(result, typeof(PartialViewResult));
        }
コード例 #4
0
        public void NavBar_Return_WithItems()
        {
            //Arrange
            var    navbar     = new NavbarController();
            string controller = "Home";
            string act        = "Index";

            //Act
            var result = navbar.Navbar(controller, act) as PartialViewResult;
            var list   = (IEnumerable <Navbar>)result.Model;

            //Assert
            Assert.AreNotEqual(0, list.Count());
        }
コード例 #5
0
        public void NavBar_Return_SameModel()
        {
            //Arrange
            var navbar  = new NavbarController();
            var navbars = new List <Navbar>();

            navbars.Add(new Navbar {
                Id = 2, nameOption = "Charts", controller = "Home", action = "Charts", imageClass = "fa fa-fw fa-bar-chart-o", estatus = true
            });
            navbars.Add(new Navbar {
                Id = 3, nameOption = "Tables", controller = "Home", action = "Tables", imageClass = "fa fa-fw fa-table", estatus = true
            });

            string controller = "Home";
            string act        = "Index";

            //Act
            var viewResult = navbar.Navbar(controller, act) as PartialViewResult;
            var viewModel  = viewResult.Model;

            //Assert
            Assert.AreSame(viewResult.Model.ToString(), navbars.ToString());
        }