Esempio n. 1
0
        public void Remove_WhenLastItemInNamespaceRemoved_NamespaceNotInDictionary()
        {
            TypeInNamespaceMap map      = new TypeInNamespaceMap();
            TypeDef            testType = CreateType("Namespace", "MyType");

            map.Add(testType);
            map.Remove(testType);

            Assert.AreEqual(0, map.GetAllNamespaces().Count);
        }
Esempio n. 2
0
        public void Remove_WhenItemInvalid_DoesNothing()
        {
            TypeInNamespaceMap map = BuildTestMap();
            int expected           = map.GetAllTypesInNamespaces().Count;

            map.Remove(CreateType("Nope", "Test1"));

            int result = map.GetAllTypesInNamespaces().Count;

            Assert.AreEqual(result, expected);
        }
Esempio n. 3
0
        public void Remove_WhenItemValid_RemovesItem()
        {
            TypeInNamespaceMap map          = BuildTestMap();
            TypeDef            itemToRemove = CreateType("First", "Test");

            map.Add(itemToRemove);
            int expected = map.GetAllTypesInNamespaces()["First"].Count - 1;

            map.Remove(itemToRemove);
            int result = map.GetAllTypesInNamespaces()["First"].Count;

            Assert.AreEqual(result, expected);
        }
Esempio n. 4
0
        public void WhenLastItemInNamespaceRemoved_Remove_NamespaceNotInDictionary()
        {
            TypeInNamespaceMap map = new TypeInNamespaceMap();

            TypeDef testType = new TypeDef();

            testType.Namespace = "Namespace";
            testType.Name      = "MyType";

            map.Add(testType);

            map.Remove(testType);

            Assert.AreEqual(0, map.GetAllNamespaces().Count);
        }
Esempio n. 5
0
        public void WhenRemovingValidItem_Remove_RemovesItem()
        {
            TypeInNamespaceMap map = BuildTestMap();

            TypeDef itemToRemove = new TypeDef();

            itemToRemove.Name      = "Test";
            itemToRemove.Namespace = "First";

            map.Add(itemToRemove);
            int expected = map.GetAllTypesInNamespaces()["First"].Count - 1;

            map.Remove(itemToRemove);
            int result = map.GetAllTypesInNamespaces()["First"].Count;

            Assert.AreEqual(result, expected);
        }
Esempio n. 6
0
        public void WhenRemovingInvalidItem_Remove_DoesNothing()
        {
            TypeInNamespaceMap map = BuildTestMap();

            TypeDef item = new TypeDef();

            item.Name      = "Nope";
            item.Namespace = "Test1";

            int expected = map.GetAllTypesInNamespaces().Count;

            map.Remove(item);

            int result = map.GetAllTypesInNamespaces().Count;

            Assert.AreEqual(result, expected);
        }