Exemple #1
0
        public virtual void TestAddToEmptyList()
        {
            RefList <Ref> one = ToList();
            RefList <Ref> two = one.Add(0, REF_B);

            NUnit.Framework.Assert.AreNotSame(one, two);
            // one is not modified, but two is
            NUnit.Framework.Assert.AreEqual(0, one.Size());
            NUnit.Framework.Assert.AreEqual(1, two.Size());
            NUnit.Framework.Assert.IsFalse(two.IsEmpty());
            NUnit.Framework.Assert.AreSame(REF_B, two.Get(0));
        }
Exemple #2
0
        public virtual void TestAddToEndOfList()
        {
            RefList <Ref> one = ToList(REF_A);
            RefList <Ref> two = one.Add(1, REF_B);

            NUnit.Framework.Assert.AreNotSame(one, two);
            // one is not modified, but two is
            NUnit.Framework.Assert.AreEqual(1, one.Size());
            NUnit.Framework.Assert.AreSame(REF_A, one.Get(0));
            NUnit.Framework.Assert.AreEqual(2, two.Size());
            NUnit.Framework.Assert.AreSame(REF_A, two.Get(0));
            NUnit.Framework.Assert.AreSame(REF_B, two.Get(1));
        }
Exemple #3
0
        public virtual void TestAddToMiddleOfListByInsertionPosition()
        {
            RefList <Ref> one = ToList(REF_A, REF_c);

            NUnit.Framework.Assert.AreEqual(-2, one.Find(REF_B.GetName()));
            RefList <Ref> two = one.Add(one.Find(REF_B.GetName()), REF_B);

            NUnit.Framework.Assert.AreNotSame(one, two);
            // one is not modified, but two is
            NUnit.Framework.Assert.AreEqual(2, one.Size());
            NUnit.Framework.Assert.AreSame(REF_A, one.Get(0));
            NUnit.Framework.Assert.AreSame(REF_c, one.Get(1));
            NUnit.Framework.Assert.AreEqual(3, two.Size());
            NUnit.Framework.Assert.AreSame(REF_A, two.Get(0));
            NUnit.Framework.Assert.AreSame(REF_B, two.Get(1));
            NUnit.Framework.Assert.AreSame(REF_c, two.Get(2));
        }