Пример #1
0
 public void MovieReviewInstanceOK()
 {
     //create an instance of the class
     MovieReview NewMovieReview = new MovieReview();
     //test to see if that exists
     Assert.IsNotNull(NewMovieReview);
 }
Пример #2
0
 public void MovieReviewDatePosted()
 {
     MovieReview NewMovieReview = new MovieReview();
     DateTime testDatePosted = DateTime.Today;
     NewMovieReview.Posted = testDatePosted;
     Assert.AreEqual(testDatePosted, NewMovieReview.Posted);
 }
        public ActionResult Create(int movieId, string username)
        {
            try
            {
                MovieReview moviereview = new MovieReview();
                moviereview.MovieId = movieId;
                moviereview.UserName = username;

                return View(moviereview);
            }
            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");
            }
        }
Пример #4
0
        public void MovieReviewReview()
        {
            //create an instance of the class
            MovieReview NewMovieReview = new MovieReview();

            string TestMovieReviewReview = "Test Message";
            NewMovieReview.Review = TestMovieReviewReview;
            //test to see if that exists
            Assert.AreEqual(NewMovieReview.Review, TestMovieReviewReview);
        }
Пример #5
0
        public void MovieReviewID()
        {
            //create an instance of the class
            MovieReview NewMovieReview = new MovieReview();

            Int32 TestMovieReviewId = 1;
            NewMovieReview.MovieReviewId = TestMovieReviewId;
            //test to see if that exists
            Assert.AreEqual(NewMovieReview.MovieReviewId, TestMovieReviewId);
        }
Пример #6
0
        public void MovieReviewExtremeLatest()
        {
            MovieReview NewMovieReview = new MovieReview();
            Boolean valid = false;
            int MovieReviewId = 1;
            string username = new string('A', MovieReview.textMidLength);
            DateTime datePosted = DateTime.Today.AddDays(+1000);
            string review = new string('A', MovieReview.textMidLength);

            valid = NewMovieReview.Valid(MovieReviewId, username, datePosted, review);
        }
Пример #7
0
        public void MovieReviewExtremeEarliestDate()
        {
            MovieReview NewMovieReview = new MovieReview();
            Boolean valid = false;
            int MovieReviewId = 1;
            string username = new string('A', MovieReview.textMidLength);
            DateTime datePosted = MovieReview.earliestDate;
            string review = new string('A', MovieReview.textMidLength);

            valid = NewMovieReview.Valid(MovieReviewId, username, datePosted, review);
        }
Пример #8
0
        public void MovieReviewReviewExtremeMaximum()
        {
            MovieReview NewMovieReview = new MovieReview();
            Boolean valid = false;
            int MovieReviewId = 1;
            string username = new string('A', MovieReview.textMidLength);
            DateTime datePosted = DateTime.Today;
            string review = new string('A', MovieReview.textExtremeMax);

            valid = NewMovieReview.Valid(MovieReviewId, username, datePosted, review);
        }
Пример #9
0
        public void MovieReviewUserNameOk()
        {
            //create an instance of the class
            MovieReview NewMovieReview = new MovieReview();

            string TestMovieReviewUserName = "******";
            NewMovieReview.UserName = TestMovieReviewUserName;
            //test to see if that exists
            Assert.AreEqual(NewMovieReview.UserName, TestMovieReviewUserName);
        }
Пример #10
0
        public void MovieReviewUsernameMinimumPlusOne()
        {
            MovieReview NewMovieReview = new MovieReview();
            Boolean valid = false;
            int MovieReviewId = 1;
            string username = new string('A', MovieReview.textMinimumLength + 1);
            DateTime datePosted = DateTime.Today;
            string review = new string('A', MovieReview.textMidLength);

            valid = NewMovieReview.Valid(MovieReviewId, username, datePosted, review);
            Assert.IsTrue(valid);
        }