Index() public method

public Index ( ) : System.Web.Mvc.ActionResult
return System.Web.Mvc.ActionResult
Ejemplo n.º 1
0
        public void GetEmptyConsorcios()
        {
            ConsorcioController controller = new ConsorcioController();

            var result = controller.Index();

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ViewResult));

            var vresult = (ViewResult)result;
            Assert.IsNotNull(vresult.Model);
            Assert.IsInstanceOfType(vresult.Model, typeof(IList<Consorcio>));
        }
Ejemplo n.º 2
0
        public void GetOneConsorcios()
        {
            ConsorcioRepository repositorio = new ConsorcioRepository();
            repositorio.Add(new Consorcio() { Nombre = "Consorcio 1" });

            ConsorcioController controller = new ConsorcioController(repositorio);

            var result = controller.Index();

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ViewResult));

            var vresult = (ViewResult)result;
            Assert.IsNotNull(vresult.Model);
            Assert.IsInstanceOfType(vresult.Model, typeof(IList<Consorcio>));

            var consorcios = (IList<Consorcio>)vresult.Model;

            Assert.AreEqual(1, consorcios.Count);
            Assert.AreEqual("Consorcio 1", consorcios[0].Nombre);
        }