public ActionResult Create(int roleReviewId, string username) { try { RoleComment rolecomment = new RoleComment(); rolecomment.RoleReviewId = roleReviewId; rolecomment.UserName = username; return View(rolecomment); } catch (DataException ex) { var contentMessage = String.Format("{0}{1}", "Wrong Data has entered: ", ex.Message); logger.Info(contentMessage); return RedirectToAction("Error", "Home"); } catch (InvalidOperationException ex) { var contentMessage = String.Format("{0}{1}", "Please close the database connection ", ex.Message); logger.Info(contentMessage); return RedirectToAction("Error", "Home"); } catch (Exception ex) { var contentMessage = String.Format("{0}{1}", "Something went wrong. ", ex.Message); logger.Info(contentMessage); return RedirectToAction("Error", "Home"); } }
public void RoleCommentInstanceOK() { //create an instance of the class RoleComment NewRoleComment = new RoleComment(); //test to see if that exists Assert.IsNotNull(NewRoleComment); }
public void RoleCommentDatePosted() { RoleComment NewRoleComment = new RoleComment(); DateTime testDatePosted = DateTime.Today; NewRoleComment.Posted = testDatePosted; Assert.AreEqual(testDatePosted, NewRoleComment.Posted); }
public void RoleCommentID() { //create an instance of the class RoleComment NewRoleComment = new RoleComment(); Int32 TestRoleCommentId = 1; NewRoleComment.RoleCommentId = TestRoleCommentId; //test to see if that exists Assert.AreEqual(NewRoleComment.RoleCommentId, TestRoleCommentId); }
public void RoleCommentComment() { //create an instance of the class RoleComment NewRoleComment = new RoleComment(); string TestRoleCommentComment = "Test Message"; NewRoleComment.Comment = TestRoleCommentComment; //test to see if that exists Assert.AreEqual(NewRoleComment.Comment, TestRoleCommentComment); }
public void RoleCommentExtremeLatest() { RoleComment NewRoleComment = new RoleComment(); Boolean valid = false; int RoleCommentId = 1; string username = new string('A', RoleComment.textMidLength); DateTime datePosted = DateTime.Today.AddDays(+1000); string comment = new string('A', RoleComment.textMidLength); valid = NewRoleComment.Valid(RoleCommentId, username, datePosted, comment); }
public void RoleCommentExtremeEarliestDate() { RoleComment NewRoleComment = new RoleComment(); Boolean valid = false; int RoleCommentId = 1; string username = new string('A', RoleComment.textMidLength); DateTime datePosted = RoleComment.earliestDate; string comment = new string('A', RoleComment.textMidLength); valid = NewRoleComment.Valid(RoleCommentId, username, datePosted, comment); }
public void RoleCommentommentExtremeMinimumLength() { RoleComment NewRoleComment = new RoleComment(); Boolean valid = false; int RoleCommentId = 1; string username = new string('A', RoleComment.textMidLength); DateTime datePosted = DateTime.Today; string comment = new string('A', RoleComment.textExtremeMin); valid = NewRoleComment.Valid(RoleCommentId, username, datePosted, comment); }
public void RoleCommentUserNameOk() { //create an instance of the class RoleComment NewRoleComment = new RoleComment(); string TestRoleCommentUserName = "******"; NewRoleComment.UserName = TestRoleCommentUserName; //test to see if that exists Assert.AreEqual(NewRoleComment.UserName, TestRoleCommentUserName); }
public void RoleCommentUsernameMinimumPlusOne() { RoleComment NewRoleComment = new RoleComment(); Boolean valid = false; int RoleCommentId = 1; string username = new string('A', RoleComment.textMinimumLength + 1); DateTime datePosted = DateTime.Today; string comment = new string('A', RoleComment.textMidLength); valid = NewRoleComment.Valid(RoleCommentId, username, datePosted, comment); Assert.IsTrue(valid); }