示例#1
0
        public void When_strategy_configured_for_endpoint_should_use_configured_strategy()
        {
            var p = new DistributionPolicy();
            var configuredStrategy = new FakeDistributionStrategy("SomeEndpoint", DistributionStrategyScope.Send);
            p.SetDistributionStrategy(configuredStrategy);

            IDistributionPolicy policy = p;
            var result = policy.GetDistributionStrategy("SomeEndpoint", DistributionStrategyScope.Send);

            Assert.That(result, Is.EqualTo(configuredStrategy));
        }
示例#2
0
        public void When_multiple_strategies_configured_endpoint_should_use_last_configured_strategy()
        {
            var p = new DistributionPolicy();
            var strategy1 = new FakeDistributionStrategy("SomeEndpoint", DistributionStrategyScope.Send);
            var strategy2 = new FakeDistributionStrategy("SomeEndpoint", DistributionStrategyScope.Send);
            p.SetDistributionStrategy(strategy1);
            p.SetDistributionStrategy(strategy2);

            IDistributionPolicy policy = p;
            var result = policy.GetDistributionStrategy("SomeEndpoint", DistributionStrategyScope.Send);

            Assert.That(result, Is.EqualTo(strategy2));
        }