/// <summary>
        /// Inject alternative container and strategy for resolving Service Types
        /// </summary>
        public ServiceManager(Container container, ServiceController serviceController)
        {
            if (serviceController == null)
                throw new ArgumentNullException("serviceController");

            this.Container = container ?? new Container();
            this.Metadata = serviceController.Metadata; //always share the same metadata
            this.ServiceController = serviceController;

            typeFactory = new ContainerResolveCache(this.Container);
        }
        public void SetUp()
		{
            appHost = new BasicAppHost().Init();
            serviceController = appHost.ServiceController;
		}
		private static void StoreAndGetCustomers(ServiceController serviceController)
		{
			var storeCustomers = new StoreCustomers {
				Customers = {
	            	new Customer { Id = 1, FirstName = "First", LastName = "Customer" },
	            	new Customer { Id = 2, FirstName = "Second", LastName = "Customer" },
	            }
			};
			serviceController.Execute(storeCustomers);

			storeCustomers = new StoreCustomers {
				Customers = {
					new Customer {Id = 3, FirstName = "Third", LastName = "Customer"},
				}
			};
			serviceController.Execute(storeCustomers);

			var response = serviceController.Execute(new GetCustomer { CustomerId = 2 });

			Assert.That(response as GetCustomerResponse, Is.Not.Null);

			var customer = ((GetCustomerResponse)response).Customer;
			Assert.That(customer.FirstName, Is.EqualTo("Second"));
		}
		public void OnBeforeEachTest()
		{
			serviceController = new ServiceController(null);
		}
		private static void RegisterServices(ServiceController serviceController, ITypeFactory typeFactory)
		{
			serviceController.RegisterServiceExecutor(typeof(StoreCustomers), typeof(StoreCustomersService), typeFactory);
			serviceController.RegisterServiceExecutor(typeof(GetCustomer), typeof(GetCustomerService), typeFactory);
		}
        public void Does_throw_on_invalid_Route_Definitions()
        {
            AppHostConfig.SkipRouteValidation = false;

            var controller = new ServiceController(() => new[] { typeof(MyService) });

            Assert.Throws<ArgumentException>(
                () => controller.RegisterRestPaths(typeof(NoSlashPrefix)));

            Assert.Throws<ArgumentException>(
                () => controller.RegisterRestPaths(typeof(UsesQueryString)));

            AppHostConfig.SkipRouteValidation = true;
        }