예제 #1
0
        public virtual void TestAddTwo()
        {
            Edit     e1 = new Edit(1, 2, 1, 1);
            Edit     e2 = new Edit(8, 8, 8, 12);
            EditList l  = new EditList();

            l.AddItem(e1);
            l.AddItem(e2);
            NUnit.Framework.Assert.AreEqual(2, l.Count);
            NUnit.Framework.Assert.AreSame(e1, l[0]);
            NUnit.Framework.Assert.AreSame(e2, l[1]);
            Iterator <Edit> i = l.Iterator();

            NUnit.Framework.Assert.AreSame(e1, i.Next());
            NUnit.Framework.Assert.AreSame(e2, i.Next());
            NUnit.Framework.Assert.IsTrue(l.Equals(l));
            NUnit.Framework.Assert.IsFalse(l.Equals(new EditList()));
            EditList l2 = new EditList();

            l2.AddItem(e1);
            l2.AddItem(e2);
            NUnit.Framework.Assert.IsTrue(l.Equals(l2));
            NUnit.Framework.Assert.IsTrue(l2.Equals(l));
            NUnit.Framework.Assert.AreEqual(l.GetHashCode(), l2.GetHashCode());
        }
예제 #2
0
        public virtual void TestEmpty()
        {
            EditList l = new EditList();

            NUnit.Framework.Assert.AreEqual(0, l.Count);
            NUnit.Framework.Assert.IsTrue(l.IsEmpty());
//			NUnit.Framework.Assert.AreEqual("EditList[]", l.ToString());
            NUnit.Framework.Assert.IsTrue(l.Equals(l));
            NUnit.Framework.Assert.IsTrue(l.Equals(new EditList()));
            NUnit.Framework.Assert.IsFalse(l.Equals(string.Empty));
            NUnit.Framework.Assert.AreEqual(l.GetHashCode(), new EditList().GetHashCode());
        }
예제 #3
0
        public virtual void TestAddTwo()
        {
            Edit     e1 = new Edit(1, 2, 1, 1);
            Edit     e2 = new Edit(8, 8, 8, 12);
            EditList l  = new EditList();

            Extensions.AddItem(l, e1);
            Extensions.AddItem(l, e2);
            NUnit.Framework.Assert.AreEqual(2, l.Count);
            NUnit.Framework.Assert.AreSame(e1, l[0]);
            NUnit.Framework.Assert.AreSame(e2, l[1]);
            Iterator <Edit> i = Extensions.Iterator(l);

            NUnit.Framework.Assert.AreSame(e1, i.Next());
            NUnit.Framework.Assert.AreSame(e2, i.Next());
            NUnit.Framework.Assert.AreEqual(l, l);
            NUnit.Framework.Assert.IsFalse(l.Equals(new EditList()));
            EditList l2 = new EditList();

            Extensions.AddItem(l2, e1);
            Extensions.AddItem(l2, e2);
            NUnit.Framework.Assert.AreEqual(l2, l);
            NUnit.Framework.Assert.AreEqual(l, l2);
            NUnit.Framework.Assert.AreEqual(AList <Edit> .GetHashCode(l), AList <Edit> .GetHashCode(l2));
        }
예제 #4
0
        public virtual void TestAddOne()
        {
            Edit     e = new Edit(1, 2, 1, 1);
            EditList l = new EditList();

            l.AddItem(e);
            NUnit.Framework.Assert.AreEqual(1, l.Count);
            NUnit.Framework.Assert.IsFalse(l.IsEmpty());
            NUnit.Framework.Assert.AreSame(e, l[0]);
            NUnit.Framework.Assert.AreSame(e, l.Iterator().Next());
            NUnit.Framework.Assert.IsTrue(l.Equals(l));
            NUnit.Framework.Assert.IsFalse(l.Equals(new EditList()));
            EditList l2 = new EditList();

            l2.AddItem(e);
            NUnit.Framework.Assert.IsTrue(l.Equals(l2));
            NUnit.Framework.Assert.IsTrue(l2.Equals(l));
            NUnit.Framework.Assert.AreEqual(l.GetHashCode(), l2.GetHashCode());
        }
예제 #5
0
        public virtual void TestEmpty()
        {
            EditList l = new EditList();

            NUnit.Framework.Assert.AreEqual(0, l.Count);
            NUnit.Framework.Assert.IsTrue(Extensions.IsEmpty(l));
            NUnit.Framework.Assert.AreEqual("EditList[]", l.ToString());
            NUnit.Framework.Assert.AreEqual(l, l);
            NUnit.Framework.Assert.AreEqual(new EditList(), l);
            NUnit.Framework.Assert.IsFalse(l.Equals(string.Empty));
            NUnit.Framework.Assert.AreEqual(AList <Edit> .GetHashCode(l), AList <Edit> .GetHashCode(new EditList()));
        }
예제 #6
0
        public virtual void TestAddOne()
        {
            Edit     e = new Edit(1, 2, 1, 1);
            EditList l = new EditList();

            Extensions.AddItem(l, e);
            NUnit.Framework.Assert.AreEqual(1, l.Count);
            NUnit.Framework.Assert.IsFalse(Extensions.IsEmpty(l));
            NUnit.Framework.Assert.AreSame(e, l[0]);
            NUnit.Framework.Assert.AreSame(e, Extensions.Iterator(l).Next());
            NUnit.Framework.Assert.AreEqual(l, l);
            NUnit.Framework.Assert.IsFalse(l.Equals(new EditList()));
            EditList l2 = new EditList();

            Extensions.AddItem(l2, e);
            NUnit.Framework.Assert.AreEqual(l2, l);
            NUnit.Framework.Assert.AreEqual(l, l2);
            NUnit.Framework.Assert.AreEqual(AList <Edit> .GetHashCode(l), AList <Edit> .GetHashCode(l2));
        }