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;
            }
        }
Exemple #2
0
 public void ResetState()
 {
     _Configuration            = null;
     _MonoRailContainer        = null;
     _UrlTokenizer             = null;
     _EngineContextFactory     = null;
     _ServiceProviderLocator   = null;
     _ControllerFactory        = null;
     _ControllerContextFactory = null;
     _StaticResourceRegistry   = null;
 }
Exemple #3
0
 /// <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;
 }
Exemple #4
0
        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;
            }
        }
Exemple #5
0
 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;
     }
 }
Exemple #6
0
 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;
     }
 }
Exemple #7
0
        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;
 }
Exemple #9
0
 public StubServiceProvider(IUrlTokenizer tokenizer, IControllerTree controllerTree)
 {
     this.tokenizer      = tokenizer;
     this.controllerTree = controllerTree;
 }
		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;
			}
		}
		/// <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;
		}
		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;
			}
		}
		public void ResetState()
		{
			_Configuration = null;
			_MonoRailContainer = null;
			_UrlTokenizer = null;
			_EngineContextFactory = null;
			_ServiceProviderLocator = null;
			_ControllerFactory = null;
			_ControllerContextFactory = null;
			_StaticResourceRegistry = null;
		}