コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void randomizedTest()
        internal virtual void RandomizedTest()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int count = 10000 + rnd.nextInt(1000);
            int count = 10000 + _rnd.Next(1000);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<org.eclipse.collections.api.tuple.primitive.ObjectLongPair<org.neo4j.values.storable.Value>> valueRefPairs = new java.util.ArrayList<>();
            IList <ObjectLongPair <Value> > valueRefPairs = new List <ObjectLongPair <Value> >();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.list.MutableList<org.eclipse.collections.api.tuple.primitive.ObjectLongPair<org.neo4j.values.storable.Value>> toRemove = new org.eclipse.collections.impl.list.mutable.FastList<>();
            MutableList <ObjectLongPair <Value> > toRemove = new FastList <ObjectLongPair <Value> >();

            for (int i = 0; i < count; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.values.storable.Value value = rnd.randomValues().nextValue();
                Value value = _rnd.randomValues().nextValue();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long ref = container.add(value);
                long @ref = _container.add(value);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.tuple.primitive.ObjectLongPair<org.neo4j.values.storable.Value> pair = pair(value, ref);
                ObjectLongPair <Value> pair = pair(value, @ref);
                if (_rnd.nextBoolean())
                {
                    toRemove.add(pair);
                }
                else
                {
                    valueRefPairs.Add(pair);
                }
            }

            toRemove.shuffleThis(_rnd.random());
            foreach (ObjectLongPair <Value> valueRefPair in toRemove)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.values.storable.Value removed = container.remove(valueRefPair.getTwo());
                Value removed = _container.remove(valueRefPair.Two);
                assertEquals(valueRefPair.One, removed);
                assertThrows(typeof(System.ArgumentException), () => _container.remove(valueRefPair.Two));
                assertThrows(typeof(System.ArgumentException), () => _container.get(valueRefPair.Two));
            }

            foreach (ObjectLongPair <Value> valueRefPair in valueRefPairs)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.values.storable.Value actualValue = container.get(valueRefPair.getTwo());
                Value actualValue = _container.get(valueRefPair.Two);
                assertEquals(valueRefPair.One, actualValue);
            }
        }