コード例 #1
0
        public void Clear()
        {
            var table_ = TestDataGenerator.GetTestData();

            table_.Clear();
            Assert.True(table_.Count == 0, $"Table wasn't cleared successfully");
        }
コード例 #2
0
        public void AddOneElement()
        {
            var    table_ = TestDataGenerator.GetTestData();
            int    key    = 4;
            string val    = "Четыре";

            table_.Add(key, "Четыре");
            Assert.True(table_[key] == val, $"Failed add key = {key} and value = {val} to container");
        }
コード例 #3
0
        public void LookThrow()
        {
            var           table_ = TestDataGenerator.GetTestData();
            List <string> vars   = new List <string> {
                "Нуль", "Один", "Два", "Три"
            };

            for (int i = 0; i < table_.Count; ++i)
            {
                Assert.True(table_[i] == vars[i], "Counting was failed");
            }
        }
コード例 #4
0
        public void CheckEnumerator()
        {
            var table_ = TestDataGenerator.GetTestData();

            List <int> keys = new List <int> {
                0, 1, 2, 3
            };
            List <string> values = new List <string> {
                "Нуль", "Один", "Два", "Три"
            };

            keys.Reverse();
            values.Reverse();

            int keyIndex    = 0;
            int valuesIndex = 0;

            foreach (var item in table_)
            {
                Assert.True(item.Key == keys[keyIndex++] &&
                            item.Value == values[valuesIndex++], "Enumerating was failed");
            }
        }
コード例 #5
0
        public void ContainsKey(int key, bool expectedResult)
        {
            var table_ = TestDataGenerator.GetTestData();

            Assert.True(table_.ContainsKey(key) == expectedResult, $"Container doesn't contain key = {key}");
        }
コード例 #6
0
        public void CheckCount()
        {
            var table_ = TestDataGenerator.GetTestData();

            Assert.True(table_.Count == 4, $"Counting was failed");
        }
コード例 #7
0
        public void RemoveOneElementByKey(int key, bool expectedResult)
        {
            var table_ = TestDataGenerator.GetTestData();

            Assert.True(table_.Remove(key) == expectedResult, $"Failed to remove element by key = {key}");
        }