Example #1
0
        public void GetEnumerator()
        {
            ComplexDoubleVector a = new ComplexDoubleVector(new Complex[4] {
                0, 1, 2, 3
            });
            IEnumerator dve = a.GetEnumerator();
            Complex     b;
            bool        c;

            c = dve.MoveNext();
            b = (Complex)dve.Current;
            Assert.AreEqual(c, true);
            Assert.AreEqual(b, (Complex)0);

            c = dve.MoveNext();
            b = (Complex)dve.Current;
            Assert.AreEqual(c, true);
            Assert.AreEqual(b, (Complex)1);

            c = dve.MoveNext();
            b = (Complex)dve.Current;
            Assert.AreEqual(c, true);
            Assert.AreEqual(b, (Complex)2);

            c = dve.MoveNext();
            b = (Complex)dve.Current;
            Assert.AreEqual(c, true);
            Assert.AreEqual(b, (Complex)3);

            c = dve.MoveNext();
            Assert.AreEqual(c, false);
        }
Example #2
0
 public void CurrentException()
 {
     ComplexDoubleVector test = new ComplexDoubleVector(new Complex[2] {
         1, 2
     });
     IEnumerator enumerator = test.GetEnumerator();
     object      value      = enumerator.Current;
 }
Example #3
0
        public void GetEnumeratorException()
        {
            ComplexDoubleVector a = new ComplexDoubleVector(new Complex[4] {
                0, 1, 2, 3
            });
            IEnumerator dve = a.GetEnumerator();

            Complex b = (Complex)dve.Current;
        }
 public void CurrentException()
 {
     Assert.Throws(typeof(InvalidOperationException), () =>
     {
         var test = new ComplexDoubleVector(new Complex[2] {
             1, 2
         });
         IEnumerator enumerator = test.GetEnumerator();
         object value           = enumerator.Current;
     });
 }
Example #5
0
        public void GetEnumeratorException()
        {
            Assert.Throws(typeof(InvalidOperationException), () =>
            {
                var a = new ComplexDoubleVector(new Complex[4] {
                    0, 1, 2, 3
                });
                IEnumerator dve = a.GetEnumerator();

                var b = (Complex)dve.Current;
            });
        }
        public void Current()
        {
            var test = new ComplexDoubleVector(new Complex[2] {
                1, 2
            });
            IEnumerator enumerator = test.GetEnumerator();
            bool        movenextresult;

            movenextresult = enumerator.MoveNext();
            Assert.IsTrue(movenextresult);
            Assert.AreEqual(enumerator.Current, test[0]);

            movenextresult = enumerator.MoveNext();
            Assert.IsTrue(movenextresult);
            Assert.AreEqual(enumerator.Current, test[1]);

            movenextresult = enumerator.MoveNext();
            Assert.IsFalse(movenextresult);
        }