Exemple #1
0
        public void CheckIfClearExceptionsWorkCorrectly()
        {
            var hashList = new DataStructures.HashingListDictionary <string, string>(10);

            hashList.MakeReadOnly();
            Assert.Throws <NotSupportedException>(() => hashList.Clear());
        }
Exemple #2
0
        public void CheckIfAddExceptionsWorkCorrectly4()
        {
            var hashList = new DataStructures.HashingListDictionary <string, string>(10);

            hashList.MakeFixedSize();
            Assert.Throws <NotSupportedException>(() => hashList.Add("1", "Ana"));
        }
Exemple #3
0
        public void CheckIfThisExceptionsWorkCorrectly3()
        {
            var hashList = new DataStructures.HashingListDictionary <string, string>(10);

            hashList.Add("1", "Ana");
            Assert.Throws <ArgumentException>(() => hashList.Add("1", "Andrei"));
        }
Exemple #4
0
        public void CheckIfAddExceptionsWorkCorrectly2()
        {
            var          hashList = new DataStructures.HashingListDictionary <string, string>(10);
            const string key      = null;

            Assert.Throws <ArgumentNullException>(() => hashList.Add(key, "Ana"));
        }
Exemple #5
0
        public void CheckIfAddWorksCorrectly2()
        {
            var hashList = new DataStructures.HashingListDictionary <int, string>(10);

            hashList.Add(1, "Ana");
            hashList.Add(11, "Andrei");
            Assert.Equal("Andrei", hashList[11]);
        }
Exemple #6
0
        public void CheckIfCopyToExceptionsWorkCorrectly2()
        {
            var hashList = new DataStructures.HashingListDictionary <string, string>(10);

            hashList.Add("1", "Ana");
            KeyValuePair <string, string>[] array = new KeyValuePair <string, string> [20];
            Assert.Throws <ArgumentOutOfRangeException>(() => hashList.CopyTo(array, -1));
        }
Exemple #7
0
        public void CheckIfThisExceptionsWorkCorrectly2()
        {
            var hashList = new DataStructures.HashingListDictionary <string, string>(10);

            hashList.Add("1", "Ana");
            hashList.MakeReadOnly();
            Assert.Throws <NotSupportedException>(() => hashList["string"] = "Banana");
        }
Exemple #8
0
        public void CheckIfRemoveWorksCorrectly()
        {
            var hashList = new DataStructures.HashingListDictionary <int, string>(10);

            hashList.Add(1, "Ana");
            hashList.Add(11, "Andrei");
            hashList.Remove(1);
            Assert.False(hashList.ContainsKey(1));
        }
Exemple #9
0
        public void CheckIfContainsExceptionsWorkCorrectly()
        {
            var hashList = new DataStructures.HashingListDictionary <string, string>(10);

            hashList.Add("1", "Ana");
            const string key = null;

            Assert.Throws <ArgumentNullException>(() => hashList.Contains(new KeyValuePair <string, string>(key, "Andrei")));
        }
Exemple #10
0
        public void CheckIfThisExceptionsWorkCorrectly1()
        {
            var hashList = new DataStructures.HashingListDictionary <string, string>(10);

            hashList.Add("1", "Ana");
            string       value;
            const string key = null;

            Assert.Throws <ArgumentNullException>(() => value = hashList[key]);
        }
Exemple #11
0
        public void CheckIfTryGetValueWorksCorrectly()
        {
            var hashList = new DataStructures.HashingListDictionary <int, string>(10);

            hashList.Add(1, "Ana");
            string value;

            hashList.TryGetValue(1, out value);
            Assert.Equal("Ana", value);
        }
Exemple #12
0
        public void CheckIfAddAfterRemoveWorksCorrectly()
        {
            var hashList = new DataStructures.HashingListDictionary <int, string>(10);

            hashList.Add(1, "Ana");
            hashList.Add(11, "Andrei");
            hashList.Add(13, "Andreas");
            hashList.Remove(11);
            hashList.Add(11, "Paul");
            Assert.NotEqual("Andrei", hashList[hashList.Find(11).actual]);
        }
Exemple #13
0
        public void CheckIfCopyToWorksCorrectly()
        {
            var hashList = new DataStructures.HashingListDictionary <int, string>(10);

            hashList.Add(1, "Ana");
            hashList.Add(11, "Andrei");
            KeyValuePair <int, string>[] array1 = { new KeyValuePair <int, string>(1, "Ana"), new KeyValuePair <int, string>(11, "Andrei") };
            KeyValuePair <int, string>[] array2 = new KeyValuePair <int, string> [2];
            hashList.CopyTo(array2, 0);
            Assert.Equal(array1, array2);
        }