예제 #1
0
        public void Test_DeleteReview()
        {
            ItineraryReviewSqlDAO testDAO = new ItineraryReviewSqlDAO(connectionString);
            int    testReviewId           = AddTestItineraryReview();
            Review review = testDAO.GetReview(testReviewId);

            Assert.AreEqual(true, testDAO.DeleteReview(testReviewId));
        }
예제 #2
0
        public void Test_GetAllReviews()
        {
            ItineraryReviewSqlDAO testDAO = new ItineraryReviewSqlDAO(connectionString);
            int testItineraryId           = AddTestItinerary();
            int startingReviewCount       = testDAO.GetAllReviews(testItineraryId).Count;

            AddTestItineraryReview();

            Assert.AreEqual(startingReviewCount + 1, testDAO.GetAllReviews(testItineraryId).Count);
        }
예제 #3
0
        public void Test_GetReview()
        {
            ItineraryReviewSqlDAO testDAO = new ItineraryReviewSqlDAO(connectionString);
            int testItineraryId           = AddTestItinerary();
            int testUserId   = AddTestUser();
            int testReviewId = AddTestItineraryReview();

            Assert.AreEqual((decimal)(2.5), testDAO.GetReview(testReviewId).Rating);
            Assert.AreEqual("test review title", testDAO.GetReview(testReviewId).Title);
            Assert.AreEqual("test review body", testDAO.GetReview(testReviewId).Detail);
            Assert.AreEqual(testItineraryId, testDAO.GetReview(testReviewId).TypeId);
            Assert.AreEqual(testUserId, testDAO.GetReview(testReviewId).UserId);
        }
예제 #4
0
        public void Test_CreateReview()
        {
            ItineraryReviewSqlDAO testDAO = new ItineraryReviewSqlDAO(connectionString);
            Review testReview             = new Review();

            int testUserId      = AddTestUser();
            int testItineraryId = AddTestItinerary();

            testReview.Rating   = 2;
            testReview.Title    = "anything";
            testReview.Detail   = "anything";
            testReview.UserName = "******";
            testReview.UserId   = testUserId;
            testReview.TypeId   = testItineraryId;

            Assert.AreEqual(true, testDAO.CreateReview(testReview));
        }