Пример #1
0
        protected override void OnStart(string[] args)
        {
            QueryHost.Initialize <InProcessQueryHost>(true);
            QueryHost.Current.Start();

            var controllerHost = new ServiceHost(QueryHost.Current);

            controllerHost.Open();
        }
        public void GivenRegistrationWhenChildProvidersExistThenRegistrationShouldBePassedToChildren()
        {
            var list = new List <IdType> {
                new IdType(), new IdType(), new IdType()
            };
            var query     = list.AsQueryable().Take(1);
            var swapQuery = list.AsQueryable().Skip(1).Take(1).Select(i => Tuple.Create(i.Id, i.IdVal));
            var provider  = new QueryInterceptingProvider <IdType>(query);
            var host      = new QueryHost <IdType, QueryInterceptingProvider <IdType> >(query.Expression, provider);
            // force resolution of a different type
            var notIntercepted = host.Select(i => Tuple.Create(i.Id, i.IdVal)).ToList();

            // now register
            provider.RegisterInterceptor(e => swapQuery.Expression);
            var intercepted = host.Select(i => Tuple.Create(i.Id, i.IdVal)).ToList();

            Assert.Single(intercepted);
            Assert.Equal(list[1].Id, intercepted[0].Item1);
        }
Пример #3
0
 protected override void OnStop()
 {
     QueryHost.Shutdown();
 }