public void GetOrderList_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.GetOrderList(); // Assert var viewResult = Assert.IsType <ViewResult>(result); Assert.Equal(OrderListSellerView, viewResult.ViewName); }