Пример #1
0
        public void RemoveTest()
        {
            IList <String> list = new FastSearchList <String>();

            list.Add("Item 1");
            list.Add("Item 2");
            list.Add("Item 3");

            list.Remove("Item 2");

            Assert.AreEqual(2, list.Count);
            Assert.AreEqual("Item 1", list[0]);
            Assert.AreEqual("Item 3", list[1]);
            Assert.AreEqual(0, list.IndexOf("Item 1"));
            Assert.AreEqual(1, list.IndexOf("Item 3"));

            list.Add("Item 4");

            Assert.AreEqual(3, list.Count);
            Assert.AreEqual("Item 1", list[0]);
            Assert.AreEqual("Item 3", list[1]);
            Assert.AreEqual("Item 4", list[2]);
            Assert.AreEqual(0, list.IndexOf("Item 1"));
            Assert.AreEqual(1, list.IndexOf("Item 3"));
            Assert.AreEqual(2, list.IndexOf("Item 4"));
        }
        public void RemoveAtTest()
        {
            IList<String> list = new FastSearchList<String>();

            list.Add("Item 1");
            list.Add("Item 2");
            list.Add("Item 3");

            list.RemoveAt(0);

            Assert.AreEqual(2, list.Count);
            Assert.AreEqual("Item 2", list[0]);
            Assert.AreEqual("Item 3", list[1]);
            Assert.AreEqual(0, list.IndexOf("Item 2"));
            Assert.AreEqual(1, list.IndexOf("Item 3"));

            list.Add("Item 1");

            Assert.AreEqual(3, list.Count);
            Assert.AreEqual("Item 2", list[0]);
            Assert.AreEqual("Item 3", list[1]);
            Assert.AreEqual("Item 1", list[2]);
            Assert.AreEqual(0, list.IndexOf("Item 2"));
            Assert.AreEqual(1, list.IndexOf("Item 3"));
            Assert.AreEqual(2, list.IndexOf("Item 1"));
        }
Пример #3
0
        public void AddDuplicateTest()
        {
            IList <String> list = new FastSearchList <String>();

            list.Add("Item 1");
            list.Add("Item 1");

            Assert.AreEqual(2, list.Count);
            Assert.AreEqual(0, list.IndexOf("Item 1"));
        }
        public void AddDuplicateTest()
        {
            IList<String> list = new FastSearchList<String>();

            list.Add("Item 1");
            list.Add("Item 1");

            Assert.AreEqual(2, list.Count);
            Assert.AreEqual(0, list.IndexOf("Item 1"));
        }
Пример #5
0
        public void InsertDuplicateTest()
        {
            IList <String> list = new FastSearchList <String>();

            list.Add("Item 1");
            list.Insert(1, "Item 1");
        }
        public void InsertDuplicateTest()
        {
            IList<String> list = new FastSearchList<String>();

            list.Add("Item 1");
            list.Insert(1, "Item 1");
        }
Пример #7
0
        public void InsertTest()
        {
            IList <String> list = new FastSearchList <String>();

            list.Add("Item 1");
            list.Add("Item 2");
            list.Add("Item 3");

            list.Insert(1, "Item 1.5");

            Assert.AreEqual(4, list.Count);
            Assert.AreEqual("Item 1", list[0]);
            Assert.AreEqual("Item 1.5", list[1]);
            Assert.AreEqual("Item 2", list[2]);
            Assert.AreEqual("Item 3", list[3]);
            Assert.AreEqual(0, list.IndexOf("Item 1"));
            Assert.AreEqual(1, list.IndexOf("Item 1.5"));
            Assert.AreEqual(2, list.IndexOf("Item 2"));
            Assert.AreEqual(3, list.IndexOf("Item 3"));
        }
        public void InsertTest()
        {
            IList<String> list = new FastSearchList<String>();

            list.Add("Item 1");
            list.Add("Item 2");
            list.Add("Item 3");

            list.Insert(1, "Item 1.5");

            Assert.AreEqual(4, list.Count);
            Assert.AreEqual("Item 1", list[0]);
            Assert.AreEqual("Item 1.5", list[1]);
            Assert.AreEqual("Item 2", list[2]);
            Assert.AreEqual("Item 3", list[3]);
            Assert.AreEqual(0, list.IndexOf("Item 1"));
            Assert.AreEqual(1, list.IndexOf("Item 1.5"));
            Assert.AreEqual(2, list.IndexOf("Item 2"));
            Assert.AreEqual(3, list.IndexOf("Item 3"));
        }
Пример #9
0
		public void decode()
		{
			MemoryStream stream = new MemoryStream(Data);
			BinaryReader reader = new BinaryReader(stream);
			this.TotalOccurance = reader.ReadInt32();
			this.NumStrings = reader.ReadInt32();
			int count = this.NumStrings;
			this.StringList = new FastSearchList<String>(count);
			for (int i = 0; i < count; i++)
			{
				StringList.Add(this.ReadString(reader, 16));
			}
		}
Пример #10
0
 public override void Decode()
 {
     MemoryStream stream = new MemoryStream(Data);
     BinaryReader reader = new BinaryReader(stream);
     TotalOccurance = reader.ReadInt32();
     NumStrings = reader.ReadInt32();
     StringList = new FastSearchList<string>(NumStrings);
     RichTextFormatting = new RichTextFormat[NumStrings];
     StringDecoder stringDecoder = new StringDecoder(this, reader);
     for (int i = 0; i < NumStrings; i++)
     {
         StringList.Add(stringDecoder.ReadString(16, out RichTextFormatting[i]));
     }
 }
Пример #11
0
        public void decode()
        {
            MemoryStream stream = new MemoryStream(Data);
            BinaryReader reader = new BinaryReader(stream);

            this.TotalOccurance = reader.ReadInt32();
            this.NumStrings     = reader.ReadInt32();
            int count = this.NumStrings;

            this.StringList = new FastSearchList <String>(count);
            for (int i = 0; i < count; i++)
            {
                StringList.Add(this.ReadString(reader, 16));
            }
        }
Пример #12
0
        public override void Decode()
        {
            MemoryStream stream = new MemoryStream(Data);
            BinaryReader reader = new BinaryReader(stream);

            TotalOccurance     = reader.ReadInt32();
            NumStrings         = reader.ReadInt32();
            StringList         = new FastSearchList <string>(NumStrings);
            RichTextFormatting = new RichTextFormat[NumStrings];
            StringDecoder stringDecoder = new StringDecoder(this, reader);

            for (int i = 0; i < NumStrings; i++)
            {
                StringList.Add(stringDecoder.ReadString(16, out RichTextFormatting[i]));
            }
        }