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); }
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); }
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); }
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); }
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); }
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); }