Exemplo n.º 1
0
 public void OneSubscription()
 {
     var configuration = new SubscriptionConfiguration();
     configuration.Consumes(new FakeConsumer(_ => null));
     var args = FakeBasicDeliverEventArgs();
     var message = new FakeConsumedMessage(new Foo(), args);
     var subscriptions = configuration.FindSubscriptions(message);
     Assert.Equal(1, subscriptions.Count());
 }
Exemplo n.º 2
0
 public void OnError()
 {
     var model = new Mock<IModel>();
     var strategy = new Mock<IFallbackStrategy>();
     var args = FakeBasicDeliverEventArgs();
     var message = new FakeConsumedMessage(new Object(), args);
     var configuration = new SubscriptionConfiguration(strategy.Object);
     configuration.Consumes(new FakeConsumer(consumedMessage => { throw new Exception(); }));
     var result = message.ConsumeAsync(configuration).Result;
     Assert.IsType<ConsumingFailure>(result);
     result.Reply(model.Object);
     strategy.Verify(_ => _.Apply(model.Object), Times.Never);
 }