//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void resetShouldSetDefault() public virtual void ResetShouldSetDefault() { BatchingIdSequence idSequence = new BatchingIdSequence(); idSequence.Set(99L); assertEquals(99L, idSequence.Peek()); assertEquals(99L, idSequence.NextId()); assertEquals(100L, idSequence.Peek()); idSequence.Reset(); assertEquals(0L, idSequence.Peek()); assertEquals(0L, idSequence.NextId()); assertEquals(1L, idSequence.Peek()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void ShouldSkipNullId() public virtual void ShouldSkipNullId() { BatchingIdSequence idSequence = new BatchingIdSequence(); idSequence.Set(IdGeneratorImpl.INTEGER_MINUS_ONE - 1); assertEquals(IdGeneratorImpl.INTEGER_MINUS_ONE - 1, idSequence.Peek()); // The 'NULL Id' should be skipped, and never be visible anywhere. // Peek should always return what nextId will return assertEquals(IdGeneratorImpl.INTEGER_MINUS_ONE - 1, idSequence.NextId()); assertEquals(IdGeneratorImpl.INTEGER_MINUS_ONE + 1, idSequence.Peek()); assertEquals(IdGeneratorImpl.INTEGER_MINUS_ONE + 1, idSequence.NextId()); // And what if someone were to set it directly to the NULL id idSequence.Set(IdGeneratorImpl.INTEGER_MINUS_ONE); assertEquals(IdGeneratorImpl.INTEGER_MINUS_ONE + 1, idSequence.Peek()); assertEquals(IdGeneratorImpl.INTEGER_MINUS_ONE + 1, idSequence.NextId()); }