Beispiel #1
0
        public void GetOrderFormCreate_WithSellerUser_ShouldReturnView()
        {
            // Arrange
            var mockUser = new Mock <ClaimsPrincipal>();

            mockUser.Setup(user => user.IsInRole(RoleName.Admin)).Returns(false);
            _controller.ControllerContext = new ControllerContext
            {
                HttpContext = new DefaultHttpContext {
                    User = mockUser.Object
                }
            };

            // Action
            var result = _controller.GetOrderFormCreate();

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.Equal(OrderFormSellerView, viewResult.ViewName);
        }