コード例 #1
0
 public void DirectorCommentInstanceOK()
 {
     //create an instance of the class
     DirectorComment NewDirectorComment = new DirectorComment();
     //test to see if that exists
     Assert.IsNotNull(NewDirectorComment);
 }
コード例 #2
0
 public ActionResult Create(int directorReviewId, string username)
 {
     try
     {
         DirectorComment directorcomment = new DirectorComment();
         directorcomment.DirectorReviewId = directorReviewId;
         directorcomment.UserName = username;
         return View(directorcomment);
     }
     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");
     }
 }
コード例 #3
0
 public void DirectorCommentDatePosted()
 {
     DirectorComment NewDirectorComment = new DirectorComment();
     DateTime testDatePosted = DateTime.Today;
     NewDirectorComment.Posted = testDatePosted;
     Assert.AreEqual(testDatePosted, NewDirectorComment.Posted);
 }
コード例 #4
0
        public void DirectorCommentID()
        {
            //create an instance of the class
            DirectorComment NewDirectorComment = new DirectorComment();

            Int32 TestDirectorCommentId = 1;
            NewDirectorComment.DirectorCommentId = TestDirectorCommentId;
            //test to see if that exists
            Assert.AreEqual(NewDirectorComment.DirectorCommentId, TestDirectorCommentId);
        }
コード例 #5
0
        public void DirectorCommentComment()
        {
            //create an instance of the class
            DirectorComment NewDirectorComment = new DirectorComment();

            string TestDirectorCommentComment = "Test Message";
            NewDirectorComment.Comment = TestDirectorCommentComment;
            //test to see if that exists
            Assert.AreEqual(NewDirectorComment.Comment, TestDirectorCommentComment);
        }
コード例 #6
0
        public void DirectorCommentExtremeLatest()
        {
            DirectorComment NewDirectorComment = new DirectorComment();
            Boolean valid = false;
            int DirectorCommentId = 1;
            string username = new string('A', DirectorComment.textMidLength);
            DateTime datePosted = DateTime.Today.AddDays(+1000);
            string comment = new string('A', DirectorComment.textMidLength);

            valid = NewDirectorComment.Valid(DirectorCommentId, username, datePosted, comment);
        }
コード例 #7
0
        public void DirectorCommentExtremeEarliestDate()
        {
            DirectorComment NewDirectorComment = new DirectorComment();
            Boolean valid = false;
            int DirectorCommentId = 1;
            string username = new string('A', DirectorComment.textMidLength);
            DateTime datePosted = DirectorComment.earliestDate;
            string comment = new string('A', DirectorComment.textMidLength);

            valid = NewDirectorComment.Valid(DirectorCommentId, username, datePosted, comment);
        }
コード例 #8
0
        public void DirectorCommentUserNameOk()
        {
            //create an instance of the class
            DirectorComment NewDirectorComment = new DirectorComment();

            string TestDirectorCommentUserName = "******";
            NewDirectorComment.UserName = TestDirectorCommentUserName;
            //test to see if that exists
            Assert.AreEqual(NewDirectorComment.UserName, TestDirectorCommentUserName);
        }
コード例 #9
0
        public void DirectorCommentUsernameMinimumPlusOne()
        {
            DirectorComment NewDirectorComment = new DirectorComment();
            Boolean valid = false;
            int DirectorCommentId = 1;
            string username = new string('A', DirectorComment.textMinimumLength + 1);
            DateTime datePosted = DateTime.Today;
            string comment = new string('A', DirectorComment.textMidLength);

            valid = NewDirectorComment.Valid(DirectorCommentId, username, datePosted, comment);
            Assert.IsTrue(valid);
        }
コード例 #10
0
        public void DirectorCommentUsernameMinimumMinus1()
        {
            DirectorComment NewDirectorComment = new DirectorComment();
            Boolean valid = false;
            int DirectorCommentId = 1;
            string username = new string('A', DirectorComment.textMinimumLength - 1);
            DateTime datePosted = DateTime.Today;
            string Comment = new string('A', DirectorComment.textMidLength);

            valid = NewDirectorComment.Valid(DirectorCommentId, username, datePosted, Comment);
        }
コード例 #11
0
        public void DirectorCommentUsernameExtremeMaximum()
        {
            DirectorComment NewDirectorComment = new DirectorComment();
            Boolean valid = false;
            int DirectorCommentId = 1;
            string username = new string('A', DirectorComment.textExtremeMax);
            DateTime datePosted = DateTime.Today;
            string comment = new string('A', DirectorComment.textMidLength);

            valid = NewDirectorComment.Valid(DirectorCommentId, username, datePosted, comment);
        }