private MockEnumerator <T> GetEnumeratorInProgress <T>(T element)
        {
            MockEnumerator <T> e = GetEnumeratorBeforeStart <T>();

            e.ToBeReturn = element;
            e.HasNext    = true;
            return(e);
        }
        public void IEnumeratorCurrentValueType()
        {
            int i = 123;
            MockEnumerator <int> ei = GetEnumeratorInProgress(i);

            ei.MoveNext();
            Assert.AreEqual(i, ((IEnumerator)ei).Current);
        }
        public void IEnumeratorCurrentReferenceType()
        {
            string s = "hello";
            MockEnumerator <string> es = GetEnumeratorInProgress(s);

            es.MoveNext();
            Assert.AreSame(s, ((IEnumerator)es).Current);
        }
        private MockEnumerator <T> GetEnumeratorAfterFinished <T>()
        {
            MockEnumerator <T> e = GetEnumeratorInProgress <T>(default(T));

            e.MoveNext();
            e.HasNext = false;
            e.MoveNext();
            return(e);
        }
        public void IsAlsoEnumerable()
        {
            MockEnumerator <string> e = new MockEnumerator <string>();
            IEnumerable <string>    genericEnumerable    = e;
            IEnumerable             nonGenericEnumerable = e;

            Assert.AreSame(e, genericEnumerable.GetEnumerator());
            Assert.AreSame(e, nonGenericEnumerable.GetEnumerator());
        }
        public void GenericCurrentAfterFinishedValueType()
        {
            MockEnumerator <int> e = GetEnumeratorAfterFinished <int>();

            Assert.AreEqual(0, e.Current);
        }
        public void GenericCurrentAfterFinishedReferenceType()
        {
            MockEnumerator <string> e = GetEnumeratorAfterFinished <string>();

            Assert.IsNull(e.Current);
        }
        public void GenericCurrentBeforeStartValueType()
        {
            MockEnumerator <int> e = GetEnumeratorBeforeStart <int>();

            Assert.AreEqual(0, e.Current);
        }
        public void GenericCurrentBeforeStartReferenceType()
        {
            MockEnumerator <string> e = GetEnumeratorBeforeStart <string>();

            Assert.IsNull(e.Current);
        }