public SyborgTestHttpModuleAppHost() { IFileSystem fileSystem = new WindowsFileSystem(); IApplicationInfo applicationInfo = new ApplicationInfo(); ITimeService timeService = new RealTimeService(); IRazorCompiler razorCompiler = new InMemoryRazorCompiler(); IRazorViewRenderingEngine viewRenderingEngine = new RazorViewRenderingEngine(fileSystem, razorCompiler); IWebServerConfiguration config = new WebServerConfiguration(); FileMimeTypesMap fileMimeTypesMap = new FileMimeTypesMap().RegisterStandardMimeTypes(); Initialize(config, fileSystem, applicationInfo, timeService, fileMimeTypesMap, viewRenderingEngine); IFileCache fileCache = new FileCache(); string webAppRootDir; if (!WebServerConfiguration.WebServerDevelopmentMode) { #if NCRUNCH webAppRootDir = @"D:\hg\ScalableMaps\WebApp\ScalableMaps\ScalableMaps.Web2"; #else webAppRootDir = ApplicationInfo.GetAppDirectoryPath(".."); #endif } else { webAppRootDir = ApplicationInfo.GetAppDirectoryPath(".."); } ContentCommand contentCommand = RegisterWebContent(webAppRootDir, fileCache, config); TestStreamCommand streamCommand = new TestStreamCommand(); AddRoute(new RegexWebRequestRoute("^Content/(?<path>.+)$", HttpMethod.GET, contentCommand)); AddRoute(new RegexWebRequestRoute("^stream/(?<path>.+)$", HttpMethod.GET, streamCommand)); AddPolicies(new IWebPolicy[] { new SecureResponseHeadersPolicy() }); }
public void Setup() { IFileSystem fileSystem = new WindowsFileSystem(); IApplicationInfo applicationInfo = new ApplicationInfo(); ITimeService timeService = new RealTimeService(); ISignal serverStopSignal = new ManualResetSignal(false); IWebServerConfiguration configuration = new WebServerConfiguration(); IRazorCompiler razorCompiler = new InMemoryRazorCompiler(); IRazorViewRenderingEngine viewRenderingEngine = new RazorViewRenderingEngine(fileSystem, razorCompiler); IWebServerController webServerController = new WebServerController(serverStopSignal); IFileMimeTypesMap fileMimeTypesMap = new FileMimeTypesMap(); IFileCache fileCache = new FileCache(); List <IWebRequestRoute> routes = new List <IWebRequestRoute>(); string contentRootDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "sample-content"); ContentCommand contentCommand = new ContentCommand(contentRootDirectory, fileSystem, fileCache); routes.Add(new RegexWebRequestRoute("^content/(?<path>.+)$", HttpMethod.GET, contentCommand)); // ReSharper disable once CollectionNeverUpdated.Local List <IWebPolicy> policies = new List <IWebPolicy>(); const string ExternalUrl = "http://localhost"; const int Port = 12345; testServiceUrl = "{0}:{1}/".Fmt(ExternalUrl, Port); host = new TestHost( configuration, ExternalUrl, Port, null, fileSystem, applicationInfo, timeService, viewRenderingEngine, fileMimeTypesMap, webServerController, routes, policies); host.Start(); IWebConfiguration webConfiguration = new WebConfiguration("Syborg.Tests"); restClientFactory = new RestClientFactory(webConfiguration); }
public void Setup() { map = new FileMimeTypesMap(); }