//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static void assertEntries(final int expected, KeyValueStoreFile file) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        internal static void AssertEntries(int expected, KeyValueStoreFile file)
        {
//JAVA TO C# CONVERTER TODO TASK: Local classes are not converted by Java to C# Converter:
//			  class Visitor implements KeyValueVisitor
            //		  {
            //				int visited;
            //
            //				@@Override public boolean visit(ReadableBuffer key, ReadableBuffer value)
            //				{
            //					 if (++visited > expected)
            //					 {
            //						  fail("should not have more than " + expected + " data entries");
            //					 }
            //					 return true;
            //				}
            //
            //				void done()
            //				{
            //					 assertEquals("number of entries", expected, visited);
            //				}
            //		  }
            Visitor visitor = new Visitor();

            file.Scan(visitor);
            visitor.done();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCreateAndOpenStoreWithDataAndEmptyHeader() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCreateAndOpenStoreWithDataAndEmptyHeader()
        {
            // given
            Format format = new Format(this);
            Data   data   = data(entry(new sbyte[] { ( sbyte )'o', ( sbyte )'n', ( sbyte )'e' }, new sbyte[] { ( sbyte )'a', ( sbyte )'l', ( sbyte )'p', ( sbyte )'h', ( sbyte )'a' }), entry(new sbyte[] { ( sbyte )'t', ( sbyte )'w', ( sbyte )'o' }, new sbyte[] { ( sbyte )'b', ( sbyte )'e', ( sbyte )'t', ( sbyte )'a' }), entry(new sbyte[] { ( sbyte )'z', ( sbyte )'e', ( sbyte )'d' }, new sbyte[] { ( sbyte )'o', ( sbyte )'m', ( sbyte )'e', ( sbyte )'g', ( sbyte )'a' }));

            // when
            using (KeyValueStoreFile file = format.Create(NoHeaders(), data))
            {
                // then
                assertTrue(file.Headers().fields().Count == 0);
                file.Scan(ExpectData(data));
                assertEquals("number of entries", 3, data.Index);
                AssertEntries(3, file);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static org.neo4j.helpers.collection.Pair<bool,java.util.List<Bytes>> find(KeyValueStoreFile file, final int min, final int max) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        private static Pair <bool, IList <Bytes> > Find(KeyValueStoreFile file, int min, int max)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<Bytes> values = new java.util.ArrayList<>();
            IList <Bytes> values = new List <Bytes>();
            bool          result = file.Scan(key => key.putInt(key.size() - 4, min), (key, value) =>
            {
                if (key.getInt(key.size() - 4) <= max)
                {
                    values.Add(new Bytes(value.get(0, new sbyte[value.size()])));
                    return(true);
                }
                return(false);
            });

            return(Pair.of(result, values));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCreateAndOpenStoreWithDataAndHeader() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCreateAndOpenStoreWithDataAndHeader()
        {
            // given
            Format format = new Format(this, "abc", "xyz");
            IDictionary <string, sbyte[]> headers = new Dictionary <string, sbyte[]>();

            headers["abc"] = new sbyte[] { ( sbyte )'h', ( sbyte )'e', ( sbyte )'l', ( sbyte )'l', ( sbyte )'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            headers["xyz"] = new sbyte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ( sbyte )'w', ( sbyte )'o', ( sbyte )'r', ( sbyte )'l', ( sbyte )'d' };
            Data data = data(entry(new sbyte[] { ( sbyte )'o', ( sbyte )'n', ( sbyte )'e' }, new sbyte[] { ( sbyte )'a', ( sbyte )'l', ( sbyte )'p', ( sbyte )'h', ( sbyte )'a' }), entry(new sbyte[] { ( sbyte )'t', ( sbyte )'w', ( sbyte )'o' }, new sbyte[] { ( sbyte )'b', ( sbyte )'e', ( sbyte )'t', ( sbyte )'a' }), entry(new sbyte[] { ( sbyte )'z', ( sbyte )'e', ( sbyte )'d' }, new sbyte[] { ( sbyte )'o', ( sbyte )'m', ( sbyte )'e', ( sbyte )'g', ( sbyte )'a' }));

            // when
            using (KeyValueStoreFile file = format.Create(headers, data))
            {
                // then
                AssertDeepEquals(headers, file.Headers());
                file.Scan(ExpectData(data));
                assertEquals("number of entries", 3, data.Index);
                AssertEntries(3, file);
            }
        }