コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void selectionPrioritiesAreKept() throws CatchupAddressResolutionException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SelectionPrioritiesAreKept()
        {
            // given various strategies with different priorities
            UpstreamDatabaseStrategySelector upstreamDatabaseStrategySelector = new UpstreamDatabaseStrategySelector(new CountedSelectionStrategy(this, _defaultMember, 5), Arrays.asList(new CountedSelectionStrategy(this, _firstMember, 1), new CountedSelectionStrategy(this, _secondMember, 1)), NullLogProvider.Instance);

            // and
            UpstreamStrategyAddressSupplier upstreamStrategyAddressSupplier = new UpstreamStrategyAddressSupplier(upstreamDatabaseStrategySelector, _topologyService);

            // when
            AdvertisedSocketAddress firstResult  = upstreamStrategyAddressSupplier.Get();
            AdvertisedSocketAddress secondResult = upstreamStrategyAddressSupplier.Get();
            AdvertisedSocketAddress thirdResult  = upstreamStrategyAddressSupplier.Get();

            // then
            assertEquals(_firstAddress, firstResult);
            assertEquals(_secondAddress, secondResult);
            assertEquals(_defaultAddress, thirdResult);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void exceptionWhenStrategiesFail() throws CatchupAddressResolutionException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ExceptionWhenStrategiesFail()
        {
            // given a guaranteed fail strategy
            UpstreamDatabaseStrategySelector upstreamDatabaseStrategySelector = new UpstreamDatabaseStrategySelector(new CountedSelectionStrategy(this, _defaultMember, 0));

            // and
            UpstreamStrategyAddressSupplier upstreamStrategyAddressSupplier = new UpstreamStrategyAddressSupplier(upstreamDatabaseStrategySelector, _topologyService);

            // then
            ExpectedException.expect(typeof(CatchupAddressResolutionException));

            // when
            upstreamStrategyAddressSupplier.Get();
        }