//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void shouldWriteAndReadEntriesOfRandomSizes(int minKeySize, int maxKeySize, int minValueSize, int maxValueSize) throws java.io.IOException private void ShouldWriteAndReadEntriesOfRandomSizes(int minKeySize, int maxKeySize, int minValueSize, int maxValueSize) { // given using (GBPTree <RawBytes, RawBytes> tree = CreateIndex(Layout())) { // when ISet <string> generatedStrings = new HashSet <string>(); IList <Pair <RawBytes, RawBytes> > entries = new List <Pair <RawBytes, RawBytes> >(); using (Writer <RawBytes, RawBytes> writer = tree.Writer()) { for (int i = 0; i < 1_000; i++) { // value, based on i RawBytes value = new RawBytes(); value.Bytes = new sbyte[Random.Next(minValueSize, maxValueSize)]; Random.NextBytes(value.Bytes); // key, randomly generated string @string; do { @string = Random.nextAlphaNumericString(minKeySize, maxKeySize); } while (!generatedStrings.Add(@string)); RawBytes key = new RawBytes(); key.Bytes = UTF8.encode(@string); entries.Add(Pair.of(key, value)); // write writer.Put(key, value); } } // then foreach (Pair <RawBytes, RawBytes> entry in entries) { using (RawCursor <Hit <RawBytes, RawBytes>, IOException> seek = tree.Seek(entry.First(), entry.First())) { assertTrue(seek.Next()); assertArrayEquals(entry.First().Bytes, seek.get().key().bytes); assertArrayEquals(entry.Other().Bytes, seek.get().value().bytes); assertFalse(seek.Next()); } } } }