Esempio n. 1
0
        public void ReviewControllerTestDetailsNull()
        {
            ReviewController controller = new ReviewController();

            ActionResult result = controller.Details(100);

            Assert.IsTrue(result is RedirectToRouteResult);
        }
Esempio n. 2
0
        public void DetailsModelDataUnitTest()
        {
            ReviewController controller = new ReviewController();

            var result = controller.Details(100) as ViewResult;
            var data   = result.Model as List <Review>;

            Assert.AreEqual("Darcy Vang", data[0].ReviewerName);
        }
Esempio n. 3
0
        public void DetailsModelUnitTest()
        {
            ReviewController controller = new ReviewController();

            var indexData = controller.Details(10) as ViewResult;
            var actual    = indexData.Model;

            Assert.IsNotNull(actual);
        }
Esempio n. 4
0
        public void ReviewControllerTestDetailsData()
        {
            ReviewController controller = new ReviewController();

            ViewResult result = (ViewResult)controller.Details(1);
            var        model  = (RestaurantReviewWebsite.Models.ReviewPageViewModel)result.Model;

            Assert.AreEqual(1, model.Review.ID);
        }
        public void DetailsDataTest()
        {
            ReviewController controller = new ReviewController();

            var result = controller.Details(4) as ViewResult;
            var data   = result.Model as List <Review>;

            Assert.AreEqual("Restaurant was great", data[0].Comment);
        }
        public void DetailsTest()
        {
            ReviewController controller = new ReviewController();

            var details = controller.Details(1) as ViewResult;
            var actual  = details.Model;

            Assert.IsNotNull(actual);
        }
Esempio n. 7
0
        public void TestDetailsOfReview()
        {
            //Arrange
            ReviewController controller = new ReviewController();
            //Act
            var result = controller.Details(19) as ViewResult;
            var data   = result.Model as Review;

            //Assert
            Assert.AreEqual("Paul", data.CustName);
        }
Esempio n. 8
0
        public void ReviewControllerDetailsReturnsView_ExpectedSuccess()
        {
            // Arrange
            var _mock = new Mock <IReviewLogic>();

            _mock.Setup(x => x.GetSingleReview(It.IsAny <Int32>())).ReturnsAsync(GetReview());
            var controllerUnderTest = new ReviewController(_context, _mock.Object);

            // Act
            var result = controllerUnderTest.Details(1);

            // Assert
            Assert.NotNull(result);
            var viewResult = Assert.IsType <Task <IActionResult> >(result);
        }
Esempio n. 9
0
        public void ReviewDetailsViewReturnsSingleReviewModel()
        {
            //Arrange
            var mock = new Mock <IReviewRepository>();

            mock.Setup(r => r.Reviews).Returns(new[]
            {
                new Review {
                    Id = 4, EmployeeId = 6
                }
            }.AsQueryable());

            var controller = new ReviewController(mock.Object);

            //Act
            var actual = controller.Details(4) as ViewResult;
            var model  = actual.Model as Review;

            //Assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(4, model.Id);
        }
Esempio n. 10
0
        public void Details_Returns_A_View()
        {
            var result = underTest.Details(1);

            Assert.IsType <ViewResult>(result);
        }