예제 #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>));
        }
예제 #2
0
        public void AddConsorcio()
        {
            ConsorcioRepository repositorio = new ConsorcioRepository();

            ConsorcioController controller = new ConsorcioController(repositorio);

            controller.Add("Consorcio Nuevo");

            var lista = repositorio.GetList();

            Assert.AreEqual(1, lista.Count);
            Assert.AreEqual("Consorcio Nuevo", lista[0].Nombre);
            Assert.AreEqual(1, lista[0].Id);
        }
예제 #3
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);
        }