public void TestReaderGreaterThanWriter()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                //write 16 uint. The writerHead will be at the end of the array
                for (var i = 0; i < 16; i++)
                {
                    _simpleNativeBag.Enqueue((uint)i);
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(64));
                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(120)); //

                //read 8 uint, the readerHead will be in the middle of the array
                for (var i = 0; i < 8; i++)
                {
                    Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(i));
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(32));
                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(120));

                //write 4 uint, now the writer head wrapped and it's before the reader head
                //capacity must stay unchanged
                for (var i = 16; i < 16 + 7; i++)
                {
                    _simpleNativeBag.Enqueue((uint)i);
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(60));
                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(120));

                //now I will surpass reader, so it won't change the capacity because there is enough space
                for (var i = 16 + 7; i < 16 + 7 + 2; i++)
                {
                    _simpleNativeBag.Enqueue((uint)i);
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(68));
                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(120));

                //dequeue everything and verify values
                int index = 8;
                while (_simpleNativeBag.IsEmpty())
                {
                    Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(index));
                    index++;
                }
            }
        }
        public void TestDoofusesScenarioByte()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                for (var i = 0; i < 32; i++)
                {
                    _simpleNativeBag.Enqueue((byte)i);
                    _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct()));
                }

                var index = 0;

                while (_simpleNativeBag.IsEmpty() == false)
                {
                    Assert.That(_simpleNativeBag.Dequeue <byte>(), Is.EqualTo(index));
                    var dequeue = _simpleNativeBag.Dequeue <EGID>();
                    index++;
                    Assert.That(_simpleNativeBag.count == 32 * 12 - index * 12);
                    Assert.That(dequeue.entityID, Is.EqualTo(1));
                    Assert.That((uint)dequeue.groupID, Is.EqualTo(0));
                }
            }
        }