本文整理汇总了C#中FutureMessage.WaitUntilAvailable方法的典型用法代码示例。如果您正苦于以下问题:C# FutureMessage.WaitUntilAvailable方法的具体用法?C# FutureMessage.WaitUntilAvailable怎么用?C# FutureMessage.WaitUntilAvailable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FutureMessage
的用法示例。
在下文中一共展示了FutureMessage.WaitUntilAvailable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_return_the_matching_details_for_the_order
public void Should_return_the_matching_details_for_the_order()
{
var response = new FutureMessage<OrderDetailsResponse>();
LocalBus.Subscribe<OrderDetailsResponse>(response.Set);
const string orderId = "ABC123";
const string customerId = "12345";
var request = new SendOrderDetailsRequest
{
RequestId = CombGuid.Generate(),
CustomerId = customerId,
OrderId = orderId,
};
LocalBus.Publish(request, x => x.SendResponseTo(LocalBus.Endpoint));
Assert.IsTrue(response.WaitUntilAvailable(5.Seconds()), "The response was not received");
Assert.AreEqual(orderId, response.Message.OrderId);
Assert.AreEqual(customerId, response.Message.CustomerId);
}
示例2: EstablishContext
protected override void EstablishContext()
{
base.EstablishContext();
_ping = new PingMessage();
_faultFuture = new FutureMessage<Fault<PingMessage, Guid>>();
_future = new FutureMessage<PingMessage, Guid>(_ping.CorrelationId);
LocalBus.SubscribeHandler<PingMessage>(message =>
{
_future.Set(message);
throw new NotSupportedException("I am a naughty consumer! I go boom!");
});
LocalBus.SubscribeHandler<Fault<PingMessage, Guid>>(message => _faultFuture.Set(message));
LocalBus.Publish(_ping);
_future.WaitUntilAvailable(1.Seconds());
}