public void Setup() { var settingsProvider = new Mock<ISettingsProvider>(); var repoResolver = new Mock<IRepositoryResolver>(); var highlightingService = new Mock<IHighlightingService>(); _controller = new RepositoryController( settingsProvider.Object, repoResolver.Object, highlightingService.Object); _testRepositoryLocation = TestUtils.GetRepositoryPath("Test"); _controller.Repository = new Repository(_testRepositoryLocation); }
public void Setup() { _resolver = new Mock<IRepositoryResolver>(); _resolver.Setup(x => x.GetRepository(It.IsAny<string>())) .Returns(new Repository(TestUtils.GetRepositoryPath("Test"))); _controller = new RepositoryController(new Mock<ISettingsProvider>().Object, _resolver.Object, null); _executingContext = new Mock<ActionExecutingContext>(); _executingContext.Setup(x => x.Controller).Returns(_controller); _actionParameters = new Dictionary<string, object>(); _executingContext.Setup(x => x.ActionParameters).Returns(_actionParameters); _actionParameters.Add("request", new RepositoryNavigationRequest()); _routeData = new RouteData(); _executingContext.Setup(x => x.RouteData).Returns(_routeData); var requestContext = new Mock<RequestContext>(); var httpContext = new HttpContextMock(); requestContext.Setup(x => x.HttpContext).Returns(httpContext.Object); _executingContext.Setup(x => x.HttpContext).Returns(httpContext.Object); _filter = new RepositoryRequestAttribute { RepositoryResolver = _resolver.Object }; }