Exemple #1
0
        private RefList <Ref> ToList(params Ref[] refs)
        {
            RefListBuilder <Ref> b = new RefListBuilder <Ref>(refs.Length);

            b.AddAll(refs, 0, refs.Length);
            return(b.ToRefList());
        }
Exemple #2
0
        public virtual void TestBuilder_AddThenSort()
        {
            RefListBuilder <Ref> builder = new RefListBuilder <Ref>(1);

            builder.Add(REF_B);
            builder.Add(REF_A);
            RefList <Ref> list = builder.ToRefList();

            NUnit.Framework.Assert.AreEqual(2, list.Size());
            NUnit.Framework.Assert.AreSame(REF_B, list.Get(0));
            NUnit.Framework.Assert.AreSame(REF_A, list.Get(1));
            builder.Sort();
            list = builder.ToRefList();
            NUnit.Framework.Assert.AreEqual(2, list.Size());
            NUnit.Framework.Assert.AreSame(REF_A, list.Get(0));
            NUnit.Framework.Assert.AreSame(REF_B, list.Get(1));
        }
Exemple #3
0
        public virtual void TestCopyConstructorReusesArray()
        {
            RefListBuilder <Ref> one = new RefListBuilder <Ref>();

            one.Add(REF_A);
            RefList <Ref> two = new RefList <Ref>(one.ToRefList());

            one.Set(0, REF_B);
            NUnit.Framework.Assert.AreSame(REF_B, two.Get(0));
        }
Exemple #4
0
        public virtual void TestBuilder_AddAll()
        {
            RefListBuilder <Ref> builder = new RefListBuilder <Ref>(1);

            Ref[] src = new Ref[] { REF_A, REF_B, REF_c, REF_A };
            builder.AddAll(src, 1, 2);
            RefList <Ref> list = builder.ToRefList();

            NUnit.Framework.Assert.AreEqual(2, list.Size());
            NUnit.Framework.Assert.AreSame(REF_B, list.Get(0));
            NUnit.Framework.Assert.AreSame(REF_c, list.Get(1));
        }