Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldEncodeSmallSetOfRandomData()
        public virtual void ShouldEncodeSmallSetOfRandomData()
        {
            // GIVEN
            int       size   = Random.Next(10_000) + 2;
            ValueType type   = ValueType.values()[Random.Next(ValueType.values().length)];
            IdMapper  mapper = mapper(type.encoder(), type.radix(), NO_MONITOR);

            // WHEN
            ValueGenerator values = new ValueGenerator(this, type.data(Random.random()));

            for (int nodeId = 0; nodeId < size; nodeId++)
            {
                mapper.Put(values.Apply(nodeId), nodeId, GLOBAL);
            }
            mapper.Prepare(values, mock(typeof(Collector)), NONE);

            // THEN
            for (int nodeId = 0; nodeId < size; nodeId++)
            {
                object value = values.Values[nodeId];
                assertEquals("Expected " + value + " to map to " + nodeId, nodeId, mapper.Get(value, GLOBAL));
            }
        }