public void Index() { // Arrange ExemplaresController controller = new ExemplaresController(); // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); }
public void EditDeveFalhar() { // Arrange ExemplaresController controller = new ExemplaresController(); // Act ViewResult result = controller.Edit(999) as ViewResult; // Assert Assert.IsNotNull(result); }
public void DetalhesDeveFalhar() { // Arrange ExemplaresController controller = new ExemplaresController(); // Act JsonResult result = controller.Detalhes(999) as JsonResult; // Assert Assert.IsNotNull(result); }
public void Create() { // Arrange ExemplaresController controller = new ExemplaresController(); // Act ViewResult result = controller.Create() as ViewResult; // Assert Assert.IsNotNull(result); Assert.AreEqual("Create", result.ViewName); }
public void SalvarDevePassar() { // Arrange ExemplaresController controller = new ExemplaresController(); Exception exception = new Exception(); Exemplar exemplar = this.InicializaExemplar(); // Act ViewResult result = controller.Create(exemplar) as ViewResult; // Assert Assert.IsNotNull(result); ModelState modelState = result.ViewData.ModelState[""]; Assert.IsNotNull(modelState); Assert.IsTrue(modelState.Errors.Any()); }
public void SalvarDeveFalharValidacao2() { // Arrange ExemplaresController controller = new ExemplaresController(); Exception exception = new Exception(); Exemplar exemplar = this.InicializaExemplar(); exemplar.titulo = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur volutpat ipsum eu ultrices congue. " + "Pellentesque congue sem vel odio posuere, in cursus neque molestie. Pellentesque facilisis sapien faucibus augue gravida porta."; // Act ViewResult result = controller.Create(exemplar) as ViewResult; // Assert Assert.IsNotNull(result); ModelState modelState = result.ViewData.ModelState[""]; Assert.IsNotNull(modelState); Assert.IsTrue(modelState.Errors.Any()); }