当前位置: 首页>>代码示例>>C#>>正文


C# SendOptions.RouteToThisInstance方法代码示例

本文整理汇总了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());
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:8,代码来源:RoutingOptionExtensionsTests.cs

示例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);
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:18,代码来源:UnicastSendRouterConnectorTests.cs

示例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
            }
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:19,代码来源:UnicastSendRouterConnectorTests.cs

示例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
            }
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:52,代码来源:UnicastSendRouterConnectorTests.cs


注:本文中的SendOptions.RouteToThisInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。