public T WithCustomPort(int portNumber) { ScenarioRepository.Unregister(_portNumber); _portNumber = portNumber; ScenarioRepository.Register(_portNumber, this); return((T)this); }
public void Configuration(IAppBuilder appBuilder) { var portNumber = Int32.Parse( (string)((IList <IDictionary <string, object> >)appBuilder.Properties["host.Addresses"])[0]["port"]); _scenario = ScenarioRepository.GetScenario(portNumber) as MockScenario; appBuilder.Use(typeof(LoggingMiddleware)); appBuilder.Run(Invoke); }
internal ScenarioBase() { _portNumber = PortRepository.GetFreePortNumber(); ScenarioRepository.Register(_portNumber, this); Container = new UnityContainer(); _httpConfiguration = new HttpConfiguration { DependencyResolver = new UnityDependencyResolver(Container) }; }
// This code configures Web API. The WebApiStartup class is specified as a type // parameter in the WebApp.Start method. public void Configuration(IAppBuilder appBuilder) { var portNumber = Int32.Parse( (string)((IList <IDictionary <string, object> >)appBuilder.Properties["host.Addresses"])[0]["port"]); var configuration = ScenarioRepository.GetHttpConfiguration(portNumber); if (configuration == null) { configuration = new HttpConfiguration(); WebApiConfig.Register(configuration); } appBuilder.UseWebApi(configuration); }
public void Dispose() { _host.Dispose(); ScenarioRepository.Unregister(_portNumber); }