public void SetUp() { _routeCollection = MockRepository.GenerateMock<IRouteCollection>(); _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return("/path"); _urlResolver = new UrlResolver(_routeCollection, _httpRuntime); }
public IEnumerable<Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl, IEnumerable<IDiagnosticConfiguration> configurations) { guidFactory.ThrowIfNull("guidFactory"); urlResolver.ThrowIfNull("urlResolver"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); configurations.ThrowIfNull("configurations"); string diagnosticsUrl = urlResolver.Absolute(diagnosticsRelativeUrl); yield return DiagnosticRouteHelper.Instance.GetViewRoute<DiagnosticsView>( "Diagnostics Home View", guidFactory, diagnosticsRelativeUrl, ResponseResources.Diagnostics, DiagnosticsViewNamespaces, httpRuntime, view => { view.UrlResolver = urlResolver; AddLinks(view, diagnosticsUrl, configurations); }); yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Common CSS", guidFactory, diagnosticsRelativeUrl + "/css/common", ResponseResources.common, httpRuntime); yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Reset CSS", guidFactory, diagnosticsRelativeUrl + "/css/reset", ResponseResources.reset, httpRuntime); yield return DiagnosticRouteHelper.Instance.GetJavaScriptRoute("Diagnostics jQuery JS", guidFactory, diagnosticsRelativeUrl + "/js/jquery", ResponseResources.jquery_1_8_2_min, httpRuntime); foreach (IDiagnosticConfiguration arg in configurations) { foreach (Routing.Route route in arg.GetRoutes(guidFactory, urlResolver, httpRuntime, diagnosticsRelativeUrl)) { yield return route; } } }
public void SetUp() { _path = Path.GetTempFileName(); File.WriteAllText(_path, ".css { text-align: right; }"); _bundle = new Bundle().File("file1"); _fileSystem = MockRepository.GenerateMock<IFileSystem>(); _fileSystem.Stub(arg => arg.AbsolutePath("file1")).Return(_path); _fileSystem .Stub(arg => arg.OpenFile(_path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) .WhenCalled(arg => arg.ReturnValue = File.OpenRead(_path)) .Return(null); _concatenator = MockRepository.GenerateMock<IAssetConcatenator>(); _concatenator .Stub(arg => arg.Concatenate(Arg<IEnumerable<string>>.Is.Anything)) .WhenCalled(arg => arg.ReturnValue = ((IEnumerable<string>)arg.Arguments.First()).First()) .Return(null); _transformer = MockRepository.GenerateMock<IAssetTransformer>(); _transformer .Stub(arg => arg.Transform(Arg<string>.Is.Anything)) .WhenCalled(arg => arg.ReturnValue = arg.Arguments.First()) .Return(null); _watcher = new BundleWatcher(_bundle, _fileSystem, _concatenator, _transformer); _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _systemClock = MockRepository.GenerateMock<ISystemClock>(); _systemClock.Stub(arg => arg.UtcDateTime).Return(new DateTime(2012, 1, 1, 0, 0, 0, DateTimeKind.Utc)); _routeId = Guid.NewGuid(); _cssBundleWatcherRoute = new CssBundleWatcherRoute("route", _routeId, "relative", _watcher, _httpRuntime, _systemClock); }
public void SetUp() { _route = new Route.Routing.Route("name", Guid.NewGuid(), "relative"); _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _container = MockRepository.GenerateMock<IContainer>(); _container.Stub(arg => arg.GetInstance<IHttpRuntime>()).Return(_httpRuntime); }
public AspNetRuntimeCache(IHttpRuntime httpRuntime, ISystemClock systemClock) { systemClock.ThrowIfNull("systemClock"); systemClock.ThrowIfNull("systemClock"); _httpRuntime = httpRuntime; _systemClock = systemClock; }
protected TemplatePathResolver(string extension, IHttpRuntime httpRuntime) { extension.ThrowIfNull("extension"); httpRuntime.ThrowIfNull("httpRuntime"); _extension = extension; _httpRuntime = httpRuntime; }
public UrlResolver(IRouteCollection routes, IHttpRuntime httpRuntime) { routes.ThrowIfNull("routes"); httpRuntime.ThrowIfNull("httpRuntime"); _routes = new Lazy <IRouteCollection>(() => routes); _httpRuntime = httpRuntime; }
public void SetUp() { _attribute = new UrlRelativePathAttribute("relative", RequestValueComparer.CaseSensitiveRegex); _route = new Route.Routing.Route("name", Guid.NewGuid(), "relative"); _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _container = MockRepository.GenerateMock<IContainer>(); _container.Stub(arg => arg.GetInstance<IHttpRuntime>()).Return(_httpRuntime); }
public IEnumerable<Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl, params IDiagnosticConfiguration[] configurations) { guidFactory.ThrowIfNull("guidFactory"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); configurations.ThrowIfNull("configurations"); return GetRoutes(guidFactory, urlResolver, httpRuntime, diagnosticsRelativeUrl, (IEnumerable<IDiagnosticConfiguration>)configurations); }
public UrlResolver(IRouteCollection routes, IHttpRuntime httpRuntime) { routes.ThrowIfNull("routes"); httpRuntime.ThrowIfNull("httpRuntime"); _routes = new Lazy<IRouteCollection>(() => routes); _httpRuntime = httpRuntime; }
public DefaultRestrictionContainer(IHttpRuntime httpRuntime) { httpRuntime.ThrowIfNull("httpRuntime"); _container = new Dictionary <Type, object> { { typeof(IHttpRuntime), httpRuntime } }; }
public UrlResolver(IRouteCollection routes, IUrlResolverConfiguration configuration, IHttpRuntime httpRuntime) { routes.ThrowIfNull("routes"); configuration.ThrowIfNull("configuration"); httpRuntime.ThrowIfNull("httpRuntime"); _routes = new Lazy <IRouteCollection>(() => routes); _configuration = configuration; _httpRuntime = httpRuntime; }
public UrlRelativePathRestriction(string relativePath, IRequestValueComparer comparer, IHttpRuntime httpRuntime) { relativePath.ThrowIfNull("relativePath"); comparer.ThrowIfNull("comparer"); httpRuntime.ThrowIfNull("httpRuntime"); _relativePath = relativePath; _comparer = comparer; _httpRuntime = httpRuntime; }
public UrlResolver(IRouteCollection routes, IUrlResolverConfiguration configuration, IHttpRuntime httpRuntime) { routes.ThrowIfNull("routes"); configuration.ThrowIfNull("configuration"); httpRuntime.ThrowIfNull("httpRuntime"); _routes = new Lazy<IRouteCollection>(() => routes); _configuration = configuration; _httpRuntime = httpRuntime; }
public DefaultBundleDependencyContainer(IHttpRuntime httpRuntime, IFileSystem fileSystem) { httpRuntime.ThrowIfNull("httpRuntime"); fileSystem.ThrowIfNull("fileSystem"); _container = new Dictionary <Type, object> { { typeof(IHttpRuntime), httpRuntime }, { typeof(IFileSystem), fileSystem }, { typeof(IGuidFactory), new GuidFactory() }, { typeof(ISystemClock), new SystemClock() } }; }
protected BundleWatcherRoute(string name, Guid id, string relativePath, BundleWatcher watcher, IHttpRuntime httpRuntime) : base(name, id) { relativePath.ThrowIfNull("relativePath"); watcher.ThrowIfNull("watcher"); httpRuntime.ThrowIfNull("httpRuntime"); _relativePath = relativePath; _watcher = watcher; _httpRuntime = httpRuntime; _watcher.BundleChanged += WatcherBundleChanged; ConfigureRoute(); }
public IEnumerable<Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl) { guidFactory.ThrowIfNull("guidFactory"); urlResolver.ThrowIfNull("urlResolver"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); yield return DiagnosticRouteHelper.Instance.GetViewRoute<RouteTableView>( "Diagnostics Route Table View", guidFactory, diagnosticsRelativeUrl + "/route_table", ResponseResources.RouteTable, RouteTableViewNamespaces, httpRuntime, view => view.Populate(urlResolver, _routes.Value, diagnosticsRelativeUrl)); yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Route Table View CSS", guidFactory, diagnosticsRelativeUrl + "/route_table/css", ResponseResources.route_table_view, httpRuntime); }
public void SetUp() { _generator = new UnmatchedRestrictionsGenerator(); _request = MockRepository.GenerateMock<HttpRequestBase>(); _route = new Route.Routing.Route("name", Guid.NewGuid(), "relative"); _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _matchedRestrictions = new[] { new UrlRelativePathRestriction("", CaseInsensitivePlainComparer.Instance, _httpRuntime) }; _unmatchedRestrictions = new IRestriction[] { new HeaderRestriction<AcceptCharsetHeader>("Accept-Charset", (Func<string, IEnumerable<AcceptCharsetHeader>>)AcceptCharsetHeader.ParseMany, header => false) }; _routeMatchResults = new[] { new RouteMatchResult(_route, MatchResult.RouteNotMatched(_matchedRestrictions, _unmatchedRestrictions)) }; }
public IEnumerable<Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl) { guidFactory.ThrowIfNull("guidFactory"); urlResolver.ThrowIfNull("urlResolver"); httpRuntime.ThrowIfNull("httpRuntime"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); yield return DiagnosticRouteHelper.Instance.GetViewRoute<AspNetView>( "Diagnostics ASP.net View", guidFactory, diagnosticsRelativeUrl + "/asp_net", ResponseResources.AspNet, AspNetViewNamespaces, httpRuntime, view => { view.UrlResolver = urlResolver; view.Populate(_cacheType, _responseGeneratorTypes, _responseHandlerTypes); }); yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics ASP.net View CSS", guidFactory, diagnosticsRelativeUrl + "/asp_net/css", ResponseResources.asp_net_view, httpRuntime); }
public void SetUp() { _routeCollection = new RouteCollection { new Route.Routing.Route("name", Guid.NewGuid(), "relative") }; _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return("/path"); _urlResolver = new UrlResolver(_routeCollection, _httpRuntime); }
public void SetUp() { _id = Guid.Parse("265e2da0-458d-40c1-850c-b8ceb1d798a4"); _routeCollection = new RouteCollection { new Route.Routing.Route("name", _id, "relative") }; _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return("/path"); _urlResolver = new UrlResolver(_routeCollection, _httpRuntime); }
public void SetUp() { _route = new Route.Routing.Route("name", Guid.NewGuid(), "route"); _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _route.RestrictByUrlRelativePath("path1", CaseInsensitivePlainComparer.Instance, _httpRuntime); _route.RestrictByUrlRelativePaths(new[] { "path2", "path3" }, _httpRuntime); }
public Route RestrictByUrlRelativePaths(IEnumerable <string> relativePaths, IRequestValueComparer comparer, IHttpRuntime httpRuntime) { relativePaths.ThrowIfNull("relativePaths"); return(AddRestrictions(relativePaths.Select(arg => new UrlRelativePathRestriction(arg, comparer, httpRuntime)))); }
public Route RestrictByUrlRelativePaths(IEnumerable <string> relativePaths, IHttpRuntime httpRuntime) { relativePaths.ThrowIfNull("relativePaths"); return(AddRestrictions(relativePaths.Select(arg => new UrlRelativePathRestriction(arg, CaseInsensitivePlainComparer.Instance, httpRuntime)))); }
public IEnumerable <Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl) { guidFactory.ThrowIfNull("guidFactory"); urlResolver.ThrowIfNull("urlResolver"); httpRuntime.ThrowIfNull("httpRuntime"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); yield return(DiagnosticRouteHelper.Instance.GetViewRoute <AspNetView>( "Diagnostics ASP.net View", guidFactory, diagnosticsRelativeUrl + "/asp_net", ResponseResources.AspNet, Enumerable.Empty <string>(), httpRuntime, view => { view.UrlResolver = urlResolver; view.Populate(_cacheType, _requestFilterTypes, _responseGeneratorTypes, _responseHandlerTypes, _errorHandlerTypes, _antiCsrfCookieManagerType, _antiCsrfNonceValidatorType, _antiCsrfResponseGeneratorType); })); yield return(DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics ASP.net View CSS", guidFactory, diagnosticsRelativeUrl + "/asp_net/css", ResponseResources.asp_net_view, httpRuntime)); }
public IEnumerable <Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl) { guidFactory.ThrowIfNull("guidFactory"); urlResolver.ThrowIfNull("urlResolver"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); yield return(DiagnosticRouteHelper.Instance.GetViewRoute <RouteTableView>( "Diagnostics Route Table View", guidFactory, diagnosticsRelativeUrl + "/route_table", ResponseResources.RouteTable, RouteTableViewNamespaces, httpRuntime, view => view.Populate(urlResolver, _routes.Value, diagnosticsRelativeUrl))); yield return(DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Route Table View CSS", guidFactory, diagnosticsRelativeUrl + "/route_table/css", ResponseResources.route_table_view, httpRuntime)); }
public Routing.Route GetJavaScriptRoute(string name, IGuidFactory guidFactory, string resolvedRelativeUrl, string javaScript, IHttpRuntime httpRuntime) { guidFactory.ThrowIfNull("guidFactory"); resolvedRelativeUrl.ThrowIfNull("resolvedRelativeUrl"); javaScript.ThrowIfNull("javaScript"); return(new Routing.Route(name, guidFactory.Random(), resolvedRelativeUrl) .RestrictByMethods(HttpMethod.Get) .RestrictByUrlRelativePath(resolvedRelativeUrl, CaseInsensitivePlainComparer.Instance, httpRuntime) .RespondWith(context => new JavaScriptResponse(javaScript))); }
public Routing.Route GetViewRoute <T>(string name, IGuidFactory guidFactory, string resolvedRelativeUrl, byte[] viewTemplate, IEnumerable <string> namespaces, IHttpRuntime httpRuntime, Action <T> populateView = null) where T : View { guidFactory.ThrowIfNull("guidFactory"); resolvedRelativeUrl.ThrowIfNull("resolvedRelativeUrl"); viewTemplate.ThrowIfNull("viewTemplate"); namespaces.ThrowIfNull("namespaces"); return(new Routing.Route(name, guidFactory.Random(), resolvedRelativeUrl) .RestrictByMethods(HttpMethod.Get) .RestrictByUrlRelativePath(resolvedRelativeUrl, CaseInsensitivePlainComparer.Instance, httpRuntime) .RespondWith(context => GetViewResponse(viewTemplate, namespaces, populateView))); }
public IEnumerable <Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl, params IDiagnosticConfiguration[] configurations) { guidFactory.ThrowIfNull("guidFactory"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); configurations.ThrowIfNull("configurations"); return(GetRoutes(guidFactory, urlResolver, httpRuntime, diagnosticsRelativeUrl, (IEnumerable <IDiagnosticConfiguration>)configurations)); }
public CSharpResolver(IHttpRuntime httpRuntime) : base(".cshtml", httpRuntime) { }
public ConfigSettings(IHttpRuntime httpRuntime, IConfigurationManager configurationManager) { _httpRuntime = httpRuntime; _configurationManager = configurationManager; }
public void SetUp() { _routeCollection = MockRepository.GenerateMock<IRouteCollection>(); _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _urlResolver = new UrlResolver(_routeCollection, _httpRuntime); }
public JavaScriptBundleWatcherRoute(string name, IGuidFactory guidFactory, string relativePath, BundleWatcher watcher, IHttpRuntime httpRuntime, ISystemClock systemClock) : base(name, guidFactory, relativePath, watcher, httpRuntime) { systemClock.ThrowIfNull("systemClock"); _systemClock = systemClock; }
public CssBundleWatcherRoute(string name, Guid id, string relativePath, BundleWatcher watcher, IHttpRuntime httpRuntime, ISystemClock systemClock) : base(name, id, relativePath, watcher, httpRuntime) { systemClock.ThrowIfNull("systemClock"); _systemClock = systemClock; }
public IEnumerable <Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl, IEnumerable <IDiagnosticConfiguration> configurations) { guidFactory.ThrowIfNull("guidFactory"); urlResolver.ThrowIfNull("urlResolver"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); configurations.ThrowIfNull("configurations"); string diagnosticsUrl = urlResolver.Absolute(diagnosticsRelativeUrl); yield return(DiagnosticRouteHelper.Instance.GetViewRoute <DiagnosticsView>( "Diagnostics Home View", guidFactory, diagnosticsRelativeUrl, ResponseResources.Diagnostics, DiagnosticsViewNamespaces, httpRuntime, view => { view.UrlResolver = urlResolver; AddLinks(view, diagnosticsUrl, configurations); })); yield return(DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Common CSS", guidFactory, diagnosticsRelativeUrl + "/css/common", ResponseResources.common, httpRuntime)); yield return(DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Reset CSS", guidFactory, diagnosticsRelativeUrl + "/css/reset", ResponseResources.reset, httpRuntime)); yield return(DiagnosticRouteHelper.Instance.GetJavaScriptRoute("Diagnostics jQuery JS", guidFactory, diagnosticsRelativeUrl + "/js/jquery", ResponseResources.jquery_1_8_2_min, httpRuntime)); foreach (IDiagnosticConfiguration arg in configurations) { foreach (Routing.Route route in arg.GetRoutes(guidFactory, urlResolver, httpRuntime, diagnosticsRelativeUrl)) { yield return(route); } } }
public VisualBasicResolver(IHttpRuntime httpRuntime) : base(".vbhtml", httpRuntime) { }
public FileSystem(IHttpRuntime httpRuntime) { httpRuntime.ThrowIfNull("httpRuntime"); _httpRuntime = httpRuntime; }
public Route RestrictByUrlRelativePath(string relativePath, IRequestValueComparer comparer, IHttpRuntime httpRuntime) { return(AddRestrictions(new UrlRelativePathRestriction(relativePath, comparer, httpRuntime))); }
public Routing.Route GetViewRoute <T>(string name, IGuidFactory guidFactory, string resolvedRelativeUrl, string viewTemplate, IEnumerable <string> namespaces, IHttpRuntime httpRuntime, Action <T> populateView = null) where T : View { return(GetViewRoute(name, guidFactory, resolvedRelativeUrl, Encoding.Default.GetBytes(viewTemplate), namespaces, httpRuntime, populateView)); }
public void SetUp() { _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return("/virtual"); _restriction = new UrlRelativePathRestriction("relative", CaseInsensitivePlainComparer.Instance, _httpRuntime); _request = MockRepository.GenerateMock<HttpRequestBase>(); _request.Stub(arg => arg.Url).Return(new Uri("http://localhost/virtual/r")); }
public void SetUp() { _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _restriction = new UrlRelativePathRestriction("relative", CaseInsensitivePlainComparer.Instance, _httpRuntime); }
public void SetUp() { _generator = new UnmatchedRestrictionsGenerator(); _request = MockRepository.GenerateMock<HttpRequestBase>(); _route = new Route.Routing.Route("name", Guid.NewGuid(), "relative"); _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>(); _matchedRestrictions = new[] { new UrlRelativePathRestriction("", CaseInsensitivePlainComparer.Instance, _httpRuntime) }; _unmatchedRestrictions = new[] { new MethodRestriction("GET") }; _routeMatchResults = new[] { new RouteMatchResult(_route, MatchResult.RouteNotMatched(_matchedRestrictions, _unmatchedRestrictions)) }; }