//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void settingLastLearnedInstanceToNegativeOneShouldAlwaysWin() public virtual void SettingLastLearnedInstanceToNegativeOneShouldAlwaysWin() { // Given Config config = mock(typeof(Config)); when(config.Get(ClusterSettings.max_acceptors)).thenReturn(10); MultiPaxosContext mpCtx = new MultiPaxosContext(null, Iterables.empty(), mock(typeof(ClusterConfiguration)), null, NullLogProvider.Instance, null, null, null, null, null, config); LearnerContext state = mpCtx.LearnerContext; // When state.SetLastKnownLearnedInstanceInCluster(1, new InstanceId(2)); state.SetLastKnownLearnedInstanceInCluster(-1, null); // Then assertThat(state.LastKnownLearnedInstanceInCluster, equalTo(-1L)); assertThat(state.LastKnownAliveUpToDateInstance, equalTo(new InstanceId(2))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldOnlyAllowHigherLastLearnedInstanceId() public virtual void ShouldOnlyAllowHigherLastLearnedInstanceId() { // Given Config config = mock(typeof(Config)); when(config.Get(ClusterSettings.max_acceptors)).thenReturn(10); MultiPaxosContext mpCtx = new MultiPaxosContext(null, Iterables.empty(), mock(typeof(ClusterConfiguration)), null, NullLogProvider.Instance, null, null, null, null, null, config); LearnerContext state = mpCtx.LearnerContext; // When state.SetLastKnownLearnedInstanceInCluster(1, new InstanceId(2)); state.SetLastKnownLearnedInstanceInCluster(0, new InstanceId(3)); // Then assertThat(state.LastKnownLearnedInstanceInCluster, equalTo(1L)); }