protected BusValidationTests(ITestOutputHelper testOutputHelper) { _validatorFactoryMock = new Mock <IValidatorFactory>(); _validatorFactoryMock .Setup(m => m.GetValidator(It.Is <Type>(type => typeof(TestMessage).IsAssignableFrom(type)))) .Returns(new TestMessageValidator()); _loggerFactory = testOutputHelper == null ? null : new XunitRebusLoggerFactory(testOutputHelper); }
public ValidationFailedStrategyTests() { LoggerFactory = new XunitRebusLoggerFactory(); Logger = LoggerFactory.GetLogger <ValidationFailedStrategyTests>(); _tx = new RebusTransactionScope(); var headers = new Dictionary <string, string> { { Headers.MessageId, Guid.NewGuid().ToString() }, { Headers.Type, typeof(TestMessage).GetSimpleAssemblyQualifiedName() } }; var transportMessage = new TransportMessage(headers, new byte[0]); StepContext = new IncomingStepContext(transportMessage, _tx.TransactionContext); StepContext.Save(Message = new Message(headers, new TestMessage())); ValidatorMock = new Mock <IValidator>(); ValidatorMock .Setup(m => m.ValidateAsync(It.IsAny <object>(), It.IsAny <CancellationToken>())) .ReturnsAsync(ValidationResult); }