本文整理汇总了C#中SendOptions.RouteToThisInstance方法的典型用法代码示例。如果您正苦于以下问题:C# SendOptions.RouteToThisInstance方法的具体用法?C# SendOptions.RouteToThisInstance怎么用?C# SendOptions.RouteToThisInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendOptions
的用法示例。
在下文中一共展示了SendOptions.RouteToThisInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsRoutingToThisInstance_Should_Return_True_When_Routed_To_This_Instance
public void IsRoutingToThisInstance_Should_Return_True_When_Routed_To_This_Instance()
{
var options = new SendOptions();
options.RouteToThisInstance();
Assert.IsTrue(options.IsRoutingToThisInstance());
}
示例2: Should_route_to_local_instance_if_requested_so
public async Task Should_route_to_local_instance_if_requested_so()
{
var behavior = InitializeBehavior(sharedQueue: "MyLocalAddress", instanceSpecificQueue: "MyInstance");
var options = new SendOptions();
options.RouteToThisInstance();
var context = CreateContext(options);
UnicastAddressTag addressTag = null;
await behavior.Invoke(context, c =>
{
addressTag = (UnicastAddressTag)c.RoutingStrategies.Single().Apply(new Dictionary<string, string>());
return TaskEx.CompletedTask;
});
Assert.AreEqual("MyInstance", addressTag.Destination);
}
示例3: Should_throw_if_requested_to_route_to_local_instance_and_instance_has_no_specific_queue
public async Task Should_throw_if_requested_to_route_to_local_instance_and_instance_has_no_specific_queue()
{
var behavior = InitializeBehavior(sharedQueue: "MyLocalAddress", instanceSpecificQueue: null);
try
{
var options = new SendOptions();
options.RouteToThisInstance();
var context = CreateContext(options);
await behavior.Invoke(context, c => TaskEx.CompletedTask);
Assert.Fail("RouteToThisInstance");
}
catch (Exception)
{
// ignored
}
}
示例4: Should_throw_if_invalid_route_combinations_are_used
public async Task Should_throw_if_invalid_route_combinations_are_used()
{
var behavior = InitializeBehavior(sharedQueue: "MyLocalAddress", instanceSpecificQueue: "MyInstance");
try
{
var options = new SendOptions();
options.RouteToThisInstance();
options.SetDestination("Destination");
var context = CreateContext(options);
await behavior.Invoke(context, c => TaskEx.CompletedTask);
Assert.Fail("RouteToThisInstance+SetDestination");
}
catch (Exception)
{
// ignored
}
try
{
var options = new SendOptions();
options.RouteToThisEndpoint();
options.SetDestination("Destination");
var context = CreateContext(options);
await behavior.Invoke(context, c => TaskEx.CompletedTask);
Assert.Fail("RouteToThisEndpoint+SetDestination");
}
catch (Exception)
{
// ignored
}
try
{
var options = new SendOptions();
options.RouteToThisEndpoint();
options.RouteToThisInstance();
var context = CreateContext(options);
await behavior.Invoke(context, c => TaskEx.CompletedTask);
Assert.Fail("RouteToThisEndpoint+RouteToThisInstance");
}
catch (Exception)
{
// ignored
}
}