public void Service(IServiceProvider provider) { controllerTree = (IControllerTree) provider.GetService(typeof(IControllerTree)); urlTokenizer = (IUrlTokenizer) provider.GetService(typeof(IUrlTokenizer)); if (controllerTree != null && urlTokenizer != null) { controllerTree.ControllerAdded += ControllerAddedToTree; } }
public void ResetState() { _Configuration = null; _MonoRailContainer = null; _UrlTokenizer = null; _EngineContextFactory = null; _ServiceProviderLocator = null; _ControllerFactory = null; _ControllerContextFactory = null; _StaticResourceRegistry = null; }
/// <summary> /// Resets the state (only used from test cases) /// </summary> public void ResetState() { configuration = null; mrContainer = null; urlTokenizer = null; engineContextFactory = null; serviceProviderLocator = null; controllerFactory = null; controllerContextFactory = null; staticResourceRegistry = null; }
public void Service(IServiceProvider provider) { controllerTree = (IControllerTree)provider.GetService(typeof(IControllerTree)); urlTokenizer = (IUrlTokenizer)provider.GetService(typeof(IUrlTokenizer)); if (controllerTree != null && urlTokenizer != null) { controllerTree.ControllerAdded += ControllerAddedToTree; } }
void EnsureServices() { if (_UrlTokenizer == null) { _UrlTokenizer = _MonoRailContainer.UrlTokenizer; } if (_EngineContextFactory == null) { _EngineContextFactory = _MonoRailContainer.EngineContextFactory; } if (_ControllerFactory == null) { _ControllerFactory = _MonoRailContainer.ControllerFactory; } if (_ControllerContextFactory == null) { _ControllerContextFactory = _MonoRailContainer.ControllerContextFactory; } if (_StaticResourceRegistry == null) { _StaticResourceRegistry = _MonoRailContainer.StaticResourceRegistryEx; } }
private void EnsureServices() { if (urlTokenizer == null) { urlTokenizer = mrContainer.UrlTokenizer; } if (engineContextFactory == null) { engineContextFactory = mrContainer.EngineContextFactory; } if (controllerFactory == null) { controllerFactory = mrContainer.ControllerFactory; } if (controllerContextFactory == null) { controllerContextFactory = mrContainer.ControllerContextFactory; } if (staticResourceRegistry == null) { staticResourceRegistry = mrContainer.StaticResourceRegistry; } }
public void Should_AddTwoUrls_WhenControllerAddedToTree() { MockRepository mocks = new MockRepository(); IUrlTokenizer tokenizer = mocks.DynamicMock <IUrlTokenizer>(); IControllerTree controllerTree = new DefaultControllerTree(); StubServiceProvider serviceProvider = new StubServiceProvider(tokenizer, controllerTree); DefaultUrlProvider provider = new DefaultUrlProvider(); provider.Service(serviceProvider); using (mocks.Record()) { tokenizer.AddDefaultRule("area/controller.rails", "area", "controller", "collection"); tokenizer.AddDefaultRule("/area/controller.rails", "area", "controller", "collection"); } using (mocks.Playback()) { controllerTree.AddController("area", "controller", typeof(SampleRestController)); } }
public StubServiceProvider(IUrlTokenizer tokenizer, IControllerTree controllerTree) { this.tokenizer = tokenizer; this.controllerTree = controllerTree; }
void EnsureServices() { if ( _UrlTokenizer == null ) { _UrlTokenizer = _MonoRailContainer.UrlTokenizer; } if ( _EngineContextFactory == null ) { _EngineContextFactory = _MonoRailContainer.EngineContextFactory; } if ( _ControllerFactory == null ) { _ControllerFactory = _MonoRailContainer.ControllerFactory; } if ( _ControllerContextFactory == null ) { _ControllerContextFactory = _MonoRailContainer.ControllerContextFactory; } if ( _StaticResourceRegistry == null ) { _StaticResourceRegistry = _MonoRailContainer.StaticResourceRegistryEx; } }