コード例 #1
0
        public void ResetNameTableEnumeratorTest()
        {
            //Alloc
            NameTable   nt  = new NameTable(header, pf.Bytes);
            IEnumerator nte = nt.GetEnumerator();

            //Act
            try
            {
                nte.MoveNext();
                string First = (string)nte.Current;
                nte.MoveNext();
                string Second = (string)nte.Current;
                nte.Reset();
                nte.MoveNext();
                string Third = (string)nte.Current;
                Assert.IsTrue(First == Third);
                Assert.IsNotNull(Third);
            }
            //Assert
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
コード例 #2
0
        public void GetNameTableEnumeratorTest()
        {
            //Alloc
            NameTable nt = new NameTable(header, pf.Bytes);

            //Act
            try
            {
                IEnumerator nte = nt.GetEnumerator();
                Assert.IsNotNull(nte);
            }
            //Assert
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
コード例 #3
0
        public void NameTableEnumeratorEnumeratesAllTest()
        {
            //Alloc
            NameTable   nt  = new NameTable(header, pf.Bytes);
            IEnumerator nte = nt.GetEnumerator();
            int         i   = 0;

            //Act
            try
            {
                while (nte.MoveNext())
                {
                    i++;
                }
                Assert.AreEqual(i, nt.Count);
            }
            //Assert
            catch (Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }