public void GetEnumeratorTest() { using NativeBuffer buffer = new NativeBuffer(20); buffer.Write(1); buffer.Write(2); var enumerator = buffer.GetEnumerator(); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(1, enumerator.Current); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(0, enumerator.Current); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(0, enumerator.Current); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(0, enumerator.Current); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(2, enumerator.Current); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(0, enumerator.Current); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(0, enumerator.Current); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(0, enumerator.Current); Assert.IsFalse(enumerator.MoveNext()); }