Ejemplo n.º 1
0
        public void Index_Get_AsksForView()
        {
            InizializeContext();
            //Arrange
            var controller = new CausaleController();

            //Act
            var result = (ViewResult)controller.Index();

            //AssertCreate
            //result.AssertViewRendered();
            //Assert.AreEqual("Index", result.);
            //Assert.IsTrue(String.IsNullOrEmpty(result.ViewName));
            Assert.IsNotNull(result);
        }
Ejemplo n.º 2
0
        public void Index_Get_RetrievesAllCausaliFromRepository()
        {
            InizializeContext();
            // Arrange
            Causale oCausale1 = GetCausale(1, "Carico");
            Causale oCausale2 = GetCausale(2, "Scarico");
            InMemoryCausaleRepository repository = new InMemoryCausaleRepository();
            repository.Add(oCausale1);
            repository.Add(oCausale2);
            var controller = new CausaleController(repository);

            // Act
            var result = (ViewResult)controller.Index();

            // Assert
            var model = (IEnumerable<Causale>)result.ViewData.Model;
            CollectionAssert.Contains(model.ToList(), oCausale1);
            CollectionAssert.Contains(model.ToList(), oCausale1);
        }