Inheritance: StandardFactory, IEventScopeContextFactory
コード例 #1
0
        public void CreatesStandardSynchronousHandlers(Type handlerType)
        {
            var testee = new EventScopingStandardFactory(new FakeDecoratorCreatingEventScopeFactory());

            IHandler handler = testee.CreateHandler(handlerType);

            handler.GetType().Should().Be(handlerType);
        }
コード例 #2
0
        public void CreatesStandardSynchronousHandlers(Type handlerType)
        {
            var testee = new EventScopingStandardFactory(new FakeDecoratorCreatingEventScopeFactory());

            IHandler handler = testee.CreateHandler(handlerType);

            handler.GetType().Should().Be(handlerType);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #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);
        }
コード例 #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);
        }