//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRemoveUpwardsFrom() public virtual void ShouldRemoveUpwardsFrom() { // given int cacheSize = 100; RaftLogMetadataCache cache = new RaftLogMetadataCache(cacheSize); for (int i = 0; i < cacheSize; i++) { cache.CacheMetadata(i, i, new LogPosition(i, i)); } // when int upFrom = 60; cache.RemoveUpwardsFrom(upFrom); // then long i = 0; for ( ; i < upFrom; i++) { RaftLogMetadataCache.RaftLogEntryMetadata metadata = cache.GetMetadata(i); assertNotNull(metadata); assertEquals(i, metadata.EntryTerm); } for ( ; i < cacheSize; i++) { assertNull(cache.GetMetadata(i)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnNullWhenMissingAnEntryInTheCache() public virtual void ShouldReturnNullWhenMissingAnEntryInTheCache() { // given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final RaftLogMetadataCache cache = new RaftLogMetadataCache(2); RaftLogMetadataCache cache = new RaftLogMetadataCache(2); // when //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final RaftLogMetadataCache.RaftLogEntryMetadata metadata = cache.getMetadata(42); RaftLogMetadataCache.RaftLogEntryMetadata metadata = cache.GetMetadata(42); // then assertNull(metadata); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldClearTheCache() public virtual void ShouldClearTheCache() { // given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final RaftLogMetadataCache cache = new RaftLogMetadataCache(2); RaftLogMetadataCache cache = new RaftLogMetadataCache(2); const long index = 12L; const long term = 12L; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.LogPosition position = new org.neo4j.kernel.impl.transaction.log.LogPosition(3, 4); LogPosition position = new LogPosition(3, 4); // when cache.CacheMetadata(index, term, position); cache.Clear(); RaftLogMetadataCache.RaftLogEntryMetadata metadata = cache.GetMetadata(index); // then assertNull(metadata); }