Exemple #1
0
        public virtual void TestPutNewEntry()
        {
            RefList <Ref> one = ToList(REF_A, REF_c);
            RefList <Ref> two = one.Put(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));
        }
Exemple #2
0
        public virtual void TestPutReplaceEntry()
        {
            Ref otherc = NewRef(REF_c.GetName());

            NUnit.Framework.Assert.AreNotSame(REF_c, otherc);
            RefList <Ref> one = ToList(REF_A, REF_c);
            RefList <Ref> two = one.Put(otherc);

            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(2, two.Size());
            NUnit.Framework.Assert.AreSame(REF_A, two.Get(0));
            NUnit.Framework.Assert.AreSame(otherc, two.Get(1));
        }