Exemplo n.º 1
0
 public void MovieCommentDatePosted()
 {
     MovieComment NewMovieComment = new MovieComment();
     DateTime testDatePosted = DateTime.Today;
     NewMovieComment.Posted = testDatePosted;
     Assert.AreEqual(testDatePosted, NewMovieComment.Posted);
 }
Exemplo n.º 2
0
 public void MovieCommentInstanceOK()
 {
     //create an instance of the class
     MovieComment NewMovieComment = new MovieComment();
     //test to see if that exists
     Assert.IsNotNull(NewMovieComment);
 }
 public ActionResult Create(int movieReviewId, string username)
 {
     try
     {
         MovieComment moviecomment = new MovieComment();
         moviecomment.MovieReviewId = movieReviewId;
         moviecomment.UserName = username;
         return View(moviecomment);
     }
     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");
     }
 }
Exemplo n.º 4
0
        public void MovieCommentID()
        {
            //create an instance of the class
            MovieComment NewMovieComment = new MovieComment();

            Int32 TestMovieCommentId = 1;
            NewMovieComment.MovieCommentId = TestMovieCommentId;
            //test to see if that exists
            Assert.AreEqual(NewMovieComment.MovieCommentId, TestMovieCommentId);
        }
Exemplo n.º 5
0
        public void MovieCommentComment()
        {
            //create an instance of the class
            MovieComment NewMovieComment = new MovieComment();

            string TestMovieCommentComment = "Test Message";
            NewMovieComment.Comment = TestMovieCommentComment;
            //test to see if that exists
            Assert.AreEqual(NewMovieComment.Comment, TestMovieCommentComment);
        }
Exemplo n.º 6
0
        public void MovieCommentExtremeLatest()
        {
            MovieComment NewMovieComment = new MovieComment();
            Boolean valid = false;
            int MovieCommentId = 1;
            string username = new string('A', MovieComment.textMidLength);
            DateTime datePosted = DateTime.Today.AddDays(+1000);
            string comment = new string('A', MovieComment.textMidLength);

            valid = NewMovieComment.Valid(MovieCommentId, username, datePosted, comment);
        }
Exemplo n.º 7
0
        public void MovieCommentExtremeEarliestDate()
        {
            MovieComment NewMovieComment = new MovieComment();
            Boolean valid = false;
            int MovieCommentId = 1;
            string username = new string('A', MovieComment.textMidLength);
            DateTime datePosted = MovieComment.earliestDate;
            string comment = new string('A', MovieComment.textMidLength);

            valid = NewMovieComment.Valid(MovieCommentId, username, datePosted, comment);
        }
Exemplo n.º 8
0
        public void MovieCommentommentExtremeMinimumLength()
        {
            MovieComment NewMovieComment = new MovieComment();
            Boolean valid = false;
            int MovieCommentId = 1;
            string username = new string('A', MovieComment.textMidLength);
            DateTime datePosted = DateTime.Today;
            string comment = new string('A', MovieComment.textExtremeMin);

            valid = NewMovieComment.Valid(MovieCommentId, username, datePosted, comment);
        }
Exemplo n.º 9
0
        public void MovieCommentUserNameOk()
        {
            //create an instance of the class
            MovieComment NewMovieComment = new MovieComment();

            string TestMovieCommentUserName = "******";
            NewMovieComment.UserName = TestMovieCommentUserName;
            //test to see if that exists
            Assert.AreEqual(NewMovieComment.UserName, TestMovieCommentUserName);
        }
Exemplo n.º 10
0
        public void MovieCommentUsernameMinimumPlusOne()
        {
            MovieComment NewMovieComment = new MovieComment();
            Boolean valid = false;
            int MovieCommentId = 1;
            string username = new string('A', MovieComment.textMinimumLength + 1);
            DateTime datePosted = DateTime.Today;
            string comment = new string('A', MovieComment.textMidLength);

            valid = NewMovieComment.Valid(MovieCommentId, username, datePosted, comment);
            Assert.IsTrue(valid);
        }