Inheritance: StandardFactory, IEventScopeContextFactory
        public void CreatesStandardSynchronousHandlers(Type handlerType)
        {
            var testee = new EventScopingStandardFactory(new FakeDecoratorCreatingEventScopeFactory());

            IHandler handler = testee.CreateHandler(handlerType);

            handler.GetType().Should().Be(handlerType);
        }
Exemplo n.º 2
0
        public void CreatesStandardSynchronousHandlers(Type handlerType)
        {
            var testee = new EventScopingStandardFactory(new FakeDecoratorCreatingEventScopeFactory());

            IHandler handler = testee.CreateHandler(handlerType);

            handler.GetType().Should().Be(handlerType);
        }
        public void DecoratesAsynchronousHandlerWithScopingHandler(Type handlerType)
        {
            var testee = new EventScopingStandardFactory(new FakeDecoratorCreatingEventScopeFactory());

            IHandler handler = testee.CreateHandler(handlerType);

            handler.Should()
                   .BeOfType<FakeDecorator>()
                   .And.Subject.As<FakeDecorator>()
                   .DecoratedHandlerType.Should()
                   .Be(handlerType);
        }
        public void CreateScopeContext_ShouldDelegateToDecorated()
        {
            var scopeContext = A.Fake<IEventScopeContext>();
            var eventScopeFactory = A.Fake<IEventScopeFactory>();
            A.CallTo(() => eventScopeFactory.CreateScopeContext()).Returns(scopeContext);

            var testee = new EventScopingStandardFactory(eventScopeFactory);

            var result = testee.CreateScopeContext();

            result.Should().BeSameAs(scopeContext);
        }
Exemplo n.º 5
0
        public void DecoratesAsynchronousHandlerWithScopingHandler(Type handlerType)
        {
            var testee = new EventScopingStandardFactory(new FakeDecoratorCreatingEventScopeFactory());

            IHandler handler = testee.CreateHandler(handlerType);

            handler.Should()
            .BeOfType <FakeDecorator>()
            .And.Subject.As <FakeDecorator>()
            .DecoratedHandlerType.Should()
            .Be(handlerType);
        }
Exemplo n.º 6
0
        public void CreateScopeContext_ShouldDelegateToDecorated()
        {
            var scopeContext      = A.Fake <IEventScopeContext>();
            var eventScopeFactory = A.Fake <IEventScopeFactory>();

            A.CallTo(() => eventScopeFactory.CreateScopeContext()).Returns(scopeContext);

            var testee = new EventScopingStandardFactory(eventScopeFactory);

            var result = testee.CreateScopeContext();

            result.Should().BeSameAs(scopeContext);
        }