public virtual async Task Start() { _sent = new TestSendObserver(TestTimeout); _consumed = new BusTestConsumeObserver(TestTimeout); _published = new BusTestPublishObserver(TestTimeout); PreCreateBus?.Invoke(this); _bus = CreateBus(); ConnectObservers(_bus); _busHandle = await _bus.StartAsync().ConfigureAwait(false); BusSendEndpoint = await GetSendEndpoint(_bus.Address).ConfigureAwait(false); InputQueueSendEndpoint = await GetSendEndpoint(InputQueueAddress).ConfigureAwait(false); _busSendObserver = BusSendEndpoint.ConnectSendObserver(_sent); _inputQueueSendObserver = InputQueueSendEndpoint.ConnectSendObserver(_sent); _busConsumeObserver = _bus.ConnectConsumeObserver(_consumed); _busPublishObserver = _bus.ConnectPublishObserver(_published); }
public async Task Should_not_complete_the_handler() { await _notSupported; await BusSendEndpoint.Send(new PongMessage((await _ping).Message.CorrelationId)); Assert.That(async() => await _response, Throws.TypeOf <TaskCanceledException>()); }
public async Task Should_receive_the_interface_proxy() { Task <ConsumeContext <IMessageA> > handler = SubscribeHandler <IMessageA>(); await BusSendEndpoint.Send <IMessageA>(new {}); await handler; }
public async Task Should_receive_the_proper_message_type() { Task <ConsumeContext <MessageA> > handler = SubscribeHandler <MessageA>(); object message = new MessageA(); await BusSendEndpoint.Send(message, typeof(MessageA)); await handler; }
public async Task Should_receive_the_proper_message_as_a_with_request_id() { Task <ConsumeContext <MessageA> > handler = SubscribeHandler <MessageA>(x => x.RequestId.HasValue); var message = new MessageA(); await BusSendEndpoint.Send(message, Pipe.New <SendContext>(x => x.UseExecute(c => c.RequestId = NewId.NextGuid()))); await handler; }
public async Task Should_receive_the_proper_message_as_a() { Task <ConsumeContext <MessageA> > handler = SubscribeHandler <MessageA>(); var message = new MessageA(); await BusSendEndpoint.Send(message); await handler; }
public async Task Should_receive_the_interface_of_the_message() { Task <ConsumeContext <IMessageA> > handler = SubscribeHandler <IMessageA>(); var message = new MessageA(); await BusSendEndpoint.Send(message); await handler; }
public void A_reactive_query_is_observing_a_bus_message() { _observable = Bus.AsObservable <PingMessage>(); _thatJustHappened = GetTask <PingMessage>(); _subscription = _observable.Subscribe(m => _thatJustHappened.TrySetResult(m)); BusSendEndpoint.Send(new PingMessage()); }
public async Task Should_deliver_the_message_to_an_interested_consumer() { Task <ConsumeContext <FirstMessageContract> > first = SubscribeHandler <FirstMessageContract>(); var message = new SomeMessageContract("Joe", 27); await BusSendEndpoint.Send(message); await first; }
public async Task Should_not_complete_the_handler() { var(_, notSupported) = await _request; Response <PingNotSupported> message = await notSupported; await BusSendEndpoint.Send(new PongMessage((await _ping).Message.CorrelationId)); var(completed, _) = await _request; Assert.That(async() => await completed, Throws.TypeOf <TaskCanceledException>()); }
public async Task Should_be_received() { Task <ConsumeContext <A> > receivedA = SubscribeHandler <A>(); var message = new A { Id = Guid.NewGuid() }; await BusSendEndpoint.Send(message); ConsumeContext <A> received = await receivedA; Assert.AreEqual(message.Id, received.Message.Id); }
public async Task Should_receive_the_proper_message_without_type() { Task <ConsumeContext <MessageA> > handler = SubscribeHandler <MessageA>(); var requestId = NewId.NextGuid(); object message = new MessageA(); await BusSendEndpoint.Send(message, context => context.RequestId = requestId); ConsumeContext <MessageA> consumeContext = await handler; consumeContext.RequestId.ShouldBe(requestId); }
public async Task Should_receive_the_proper_message_as_a_with_request_id() { Task <ConsumeContext <MessageA> > handler = SubscribeHandler <MessageA>(x => x.RequestId.HasValue); var requestId = NewId.NextGuid(); var message = new MessageA(); await BusSendEndpoint.Send(message, c => c.RequestId = requestId); ConsumeContext <MessageA> consumeContext = await handler; consumeContext.RequestId.ShouldBe(requestId); }
public async Task An_exception_should_be_thrown() { var message = new InitiateSimpleSaga(_sagaId); await BusSendEndpoint.Send(message); try { await BusSendEndpoint.Send(message); } catch (SagaException sex) { Assert.AreEqual(sex.MessageType, typeof(InitiateSimpleSaga)); } }