コード例 #1
0
        public void get_item_with_key_5_Five() //получить элемент по составному ключу (5, "Five")
        {
            //arrange
            MyCollection <int, string, string> mycoll = new MyCollection <int, string, string>();

            mycoll.AddToCollection(5, "Five", "Val_5_Five");
            mycoll.AddToCollection(5, "Six", "Val_5_Six");
            mycoll.AddToCollection(6, "Five", "Val_6_Five");
            mycoll.AddToCollection(2, "Two", "Val_2_Two");
            mycoll.AddToCollection(3, "Two", "Val_3_Two");
            mycoll.AddToCollection(3, "One", "Val_3_One");
            mycoll.AddToCollection(5, "Seven", "Val_5_Seven");

            //act

            //assert
            Assert.IsTrue("Val_5_Five" == mycoll.GetBuyIDandName(5, "Five"));
        }
コード例 #2
0
        public void add_item_with_non_unique_key() //попытка вставить элемент имеющий неуникальный составной ключ
        {
            //arrange
            MyCollection <int, string, string> mycoll = new MyCollection <int, string, string>();

            mycoll.AddToCollection(5, "Five", "Val_5_Five");
            mycoll.AddToCollection(5, "Six", "Val_5_Six");
            mycoll.AddToCollection(6, "Five", "Val_6_Five");
            mycoll.AddToCollection(2, "Two", "Val_2_Two");
            mycoll.AddToCollection(3, "Two", "Val_3_Two");
            mycoll.AddToCollection(3, "One", "Val_3_One");
            mycoll.AddToCollection(5, "Seven", "Val_5_Seven");

            //act
            mycoll.AddToCollection(5, "Five", "Dubbed");

            //assert
            Assert.IsFalse("Dubbed" == mycoll.GetBuyIDandName(5, "Five"));
        }
コード例 #3
0
        public void remove_item() //удалить элемент с составном ключом (5, "Five")
        {
            //arrange
            MyCollection <int, string, string> mycoll = new MyCollection <int, string, string>();

            mycoll.AddToCollection(5, "Five", "Val_5_Five");
            mycoll.AddToCollection(5, "Six", "Val_5_Six");
            mycoll.AddToCollection(6, "Five", "Val_6_Five");
            mycoll.AddToCollection(2, "Two", "Val_2_Two");
            mycoll.AddToCollection(3, "Two", "Val_3_Two");
            mycoll.AddToCollection(3, "One", "Val_3_One");
            mycoll.AddToCollection(5, "Seven", "Val_5_Seven");

            //act
            mycoll.Remove(5, "Five");

            //assert
            Assert.IsTrue(mycoll.GetBuyIDandName(5, "Five") == null);
        }