Ejemplo n.º 1
0
        public void ShouldFindContextWithoutExplicitlyAdding()
        {
            locator
            .Register(Awareness.Of(() => locator.GetInstance <ISomeService>()))
            .Register(Given <ISomeService> .Then <SomeService>())
            .Register(Given <ITestInterface> .When <ISomeService>(i => i.SomeMethod()).Then <TestCase1>())
            .Register(Given <ITestInterface> .Then <TestCase2>());

            Assert.IsInstanceOf <TestCase1>(locator.GetInstance <ITestInterface>());
        }
Ejemplo n.º 2
0
 public Action <IServiceLocator> Build()
 {
     return(serviceLocator =>
            serviceLocator
            .Register(Awareness.Of(serviceLocator.GetInstance <HandlerContext>))
            .Register(Given <ServiceBusRoute> .Then <ServiceBusRoute>())
            .Register(Given <IHttpHandler> .When <HandlerContext>(ctx => ctx.Type == null).Then <MvcControllerHandler>())
            .Register(Given <IHttpHandler> .Then <ServiceBusHandler>())
            .Register(Given <ServiceBusRouteHandler> .Then <ServiceBusRouteHandler>())
            .Register <Singleton>(Given <IServiceBus> .Then <ServiceBus>())
            .Register(Given <TypeFinder> .Then <TypeFinder>())
            .Register(Given <HandlerContext> .Then <HandlerContext>())
            .Register(Given <NativeAdapter> .Then <NativeAdapter>()));
 }