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); }
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); }