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>)); }
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); }