public void StaticYieldOnly()
        {
            var serializer = new IteratorStateConverter();

            IEnumerator <int> iterator = SerializationCoroutines.StaticYieldOnly().GetEnumerator();

            iterator.MoveNext();

            IteratorState state1 = serializer.ToState(iterator);

            Assert.True((int)state1.Current == 1);

            iterator.MoveNext();

            IteratorState state2 = serializer.ToState(iterator);

            Assert.True((int)state2.Current == 2);
        }
        public void StaticYieldWithVarAndArg()
        {
            var serializer = new IteratorStateConverter();

            IEnumerator <int> iterator = SerializationCoroutines.StaticYieldWithVarAndArg(5).GetEnumerator();

            iterator.MoveNext();

            IteratorState state1 = serializer.ToState(iterator);

            Assert.True((int)state1.Current == 5);

            iterator.MoveNext();

            IteratorState state2 = serializer.ToState(iterator);

            Assert.True((int)state2.Current == 15);

            var newIterator = (IEnumerator <int>)serializer.FromState(state2);

            Assert.True(newIterator.Current == 15);
        }