public void FiringEvent_WhenMapperThrowsException_MustPassRequiredArgumentsToMissingMappingAction() { this.SetupManageEventBroker(); this.SetupEventTopicAndConvention(); this.SetupPublication(); this.SetupDestinationEventArgsProvider(); var exception = new InvalidOperationException(); this.mapper.Setup(m => m.Map(It.IsAny <Type>(), It.IsAny <Type>(), It.IsAny <EventArgs>())) .Throws(exception); IMissingMappingContext context = null; this.testee.SetMissingMappingAction(ctx => { context = ctx; }); this.testee.FiringEvent(this.eventTopic.Object, this.publication.Object, this, EventArgs.Empty); Assert.NotNull(context); Assert.Same(this.eventTopic.Object, context.EventTopic); Assert.Same(MappedTopicUri, context.DestinationTopic); Assert.Same(this.publication.Object, context.Publication); Assert.Same(this, context.Sender); Assert.Same(EventArgs.Empty, context.EventArgs); Assert.Same(exception, context.Exception); }
public void FiringEvent_WhenNoMappingDefined_MustPassRequiredArgumentsToMissingMappingAction() { this.SetupManageEventBroker(); this.SetupEventTopicAndConvention(); this.SetupPublication(); IMissingMappingContext context = null; this.testee.SetMissingMappingAction(ctx => { context = ctx; }); this.testee.FiringEvent(this.eventTopic.Object, this.publication.Object, this, EventArgs.Empty); Assert.NotNull(context); Assert.Same(this.eventTopic.Object, context.EventTopic); Assert.Same(MappedTopicUri, context.DestinationTopic); Assert.Same(this.publication.Object, context.Publication); Assert.Same(this, context.Sender); Assert.Same(EventArgs.Empty, context.EventArgs); Assert.IsType <ArgumentException>(context.Exception); }