상속: Controller
        public void Index()
        {
            // Arrange
            Mock<IDigipostService> digipostServiceMock = new Mock<IDigipostService>();
            var controller = new SearchController(digipostServiceMock.Object);

            // Act
            var result = controller.Index(null) as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
 private static SearchController SearchControllerWithMockedDigipostServiceAndSessionState(string searchString,
     SearchDetailsResult searchDetailsResult)
 {
     var digipostService = new Mock<DigipostService>();
     digipostService.Setup(x => x.Search(searchString)).ReturnsAsync(searchDetailsResult);
     var controller = new SearchController(digipostService.Object);
     var context = new Mock<HttpContextBase>();
     var session = new Mock<HttpSessionStateBase>();
     context.Setup(x => x.Session).Returns(session.Object);
     var requestContext = new RequestContext(context.Object, new RouteData());
     controller.ControllerContext = new ControllerContext(requestContext, controller);
     return controller;
 }
        private static SearchController SearchControllerWithMockedSessionState(ISearchDetailsResult searchDetailsResult)
        {
            var digipostServiceMock =new Mock<IDigipostService>();
            var controller = new SearchController(digipostServiceMock.Object);
            var context = new Mock<HttpContextBase>();
            var session = new Mock<HttpSessionStateBase>();
            session.Setup(x => x[SessionConstants.PersonDetails]).Returns(searchDetailsResult);

            context.Setup(x => x.Session).Returns(session.Object);

            var requestContext = new RequestContext(context.Object, new RouteData());
            controller.ControllerContext = new ControllerContext(requestContext, controller);

            return controller;
        }