public void UserComments() { UserCommentsController controller = new UserCommentsController(); var result = controller.Details(1); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(object)); }
public void UserCommentsDetailsNew() { UserCommentsController controller = new UserCommentsController(); var result = (HttpStatusCodeResult)controller.Details(-1); Assert.AreEqual(404, result.StatusCode); Assert.IsInstanceOfType(result, typeof(HttpStatusCodeResult)); }
public void UserCommentsIndex() { UserCommentsController controller = new UserCommentsController(); var result = controller.Index(); Assert.IsInstanceOfType(result, typeof(ViewResult)); }
public void UserCommentsCreateInvalidInput() { UserCommentsController controller = new UserCommentsController(); UserComment uc = new UserComment(); uc.UserCommentId = 1; uc.AccomodationId = 1; uc.Comment = "Some new comment"; uc.ApplicationUserId = "12345"; uc.UserName = "******"; uc.Rating = -2; uc.ReportCount = -5; var context = new ValidationContext(uc, null, null); var results = new List<ValidationResult>(); TypeDescriptor.AddProviderTransparent(new AssociatedMetadataTypeTypeDescriptionProvider(typeof(UserComment), typeof(UserComment)), typeof(UserComment)); var isModelStateValid = Validator.TryValidateObject(uc, context, results, true); Assert.AreEqual(false, isModelStateValid); }
public void CreateValidate() { UserCommentsController controller = new UserCommentsController(); var result = controller.Create() as ViewResult; var newResult = controller.Create(); Assert.IsInstanceOfType(newResult, typeof(ViewResult)); }
public void UserCommentsDelete() { UserCommentsController controller = new UserCommentsController(); var result = controller.Delete(1); Assert.IsNotNull(result); }
public void UserCommentsDeleteNull() { UserCommentsController controller = new UserCommentsController(); var result = (HttpStatusCodeResult)controller.Delete(null); Assert.AreEqual(400, result.StatusCode); Assert.IsInstanceOfType(result, typeof(HttpStatusCodeResult)); }
public void UserCommentsEditId() { UserCommentsController controller = new UserCommentsController(); var result = (HttpStatusCodeResult)controller.Edit((int?)null); Assert.AreEqual(400, result.StatusCode); Assert.IsInstanceOfType(result, typeof(HttpStatusCodeResult)); }