예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldAddAndReadMultipleKeys() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldAddAndReadMultipleKeys()
        {
            IList <GenericKey> keys = new List <GenericKey>();
            int numberOfKeys        = 1000;

            for (int i = 0; i < numberOfKeys; i++)
            {
                keys.Add(RandomKey(i));
            }
            using (IndexKeyStorage <GenericKey> keyStorage = keyStorage())
            {
                foreach (GenericKey key in keys)
                {
                    keyStorage.add(key);
                }
                keyStorage.doneAdding();
                using (IndexKeyStorage.KeyEntryCursor <GenericKey> reader = keyStorage.reader())
                {
                    foreach (GenericKey expected in keys)
                    {
                        assertTrue(reader.Next());
                        GenericKey actual = reader.Key();
                        assertEquals(0, _layout.compare(expected, actual), "Expected stored key to be equal to original.");
                    }
                    assertFalse(reader.Next(), "Expected reader to have no more entries, but had at least one additional " + reader.Key());
                }
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldAddAndReadZeroKey() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldAddAndReadZeroKey()
        {
            using (IndexKeyStorage <GenericKey> keyStorage = keyStorage())
            {
                keyStorage.doneAdding();
                using (IndexKeyStorage.KeyEntryCursor <GenericKey> reader = keyStorage.reader())
                {
                    assertFalse(reader.Next(), "Didn't expect reader to have any entries.");
                }
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldAddAndReadOneKey() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldAddAndReadOneKey()
        {
            using (IndexKeyStorage <GenericKey> keyStorage = keyStorage())
            {
                GenericKey expected = RandomKey(1);
                keyStorage.add(expected);
                keyStorage.doneAdding();
                using (IndexKeyStorage.KeyEntryCursor <GenericKey> reader = keyStorage.reader())
                {
                    assertTrue(reader.Next(), "Expected reader to have one entry");
                    GenericKey actual = reader.Key();
                    assertEquals(0, _layout.compare(expected, actual), "Expected stored key to be equal to original.");
                    assertFalse(reader.Next(), "Expected reader to have only one entry, second entry was " + reader.Key());
                }
            }
        }
예제 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: IndexKeyStorage.KeyEntryCursor<KEY> allConflicts() throws java.io.IOException
            internal virtual IndexKeyStorage.KeyEntryCursor <KEY> AllConflicts()
            {
                AllConflictingKeys.doneAdding();
                return(AllConflictingKeys.reader());
            }