public void TestEntrySetClear() { DirtyFlagMap dirtyFlagMap = new DirtyFlagMap(); ISet entrySet = dirtyFlagMap.EntrySet(); entrySet.Clear(); Assert.IsFalse(dirtyFlagMap.Dirty); dirtyFlagMap.Put("a", "Y"); dirtyFlagMap.ClearDirtyFlag(); entrySet.Clear(); Assert.IsTrue(dirtyFlagMap.Dirty); }
public void TestRemove() { DirtyFlagMap <string, string> dirtyFlagMap = new DirtyFlagMap <string, string>(); dirtyFlagMap.Put("a", "Y"); dirtyFlagMap.ClearDirtyFlag(); dirtyFlagMap.Remove("b"); Assert.IsFalse(dirtyFlagMap.Dirty); dirtyFlagMap.Remove("a"); Assert.IsTrue(dirtyFlagMap.Dirty); }
public void TestClear() { DirtyFlagMap <string, string> dirtyFlagMap = new DirtyFlagMap <string, string>(); Assert.IsFalse(dirtyFlagMap.Dirty); dirtyFlagMap.Clear(); Assert.IsFalse(dirtyFlagMap.Dirty); dirtyFlagMap.Put("X", "Y"); dirtyFlagMap.ClearDirtyFlag(); dirtyFlagMap.Clear(); Assert.IsTrue(dirtyFlagMap.Dirty); }
public void TestValuesClear() { DirtyFlagMap dirtyFlagMap = new DirtyFlagMap(); IList values = new ArrayList(dirtyFlagMap.Values); values.Clear(); Assert.IsFalse(dirtyFlagMap.Dirty); dirtyFlagMap.Put("a", "Y"); dirtyFlagMap.ClearDirtyFlag(); values.Clear(); Assert.IsTrue(dirtyFlagMap.Dirty); Assert.AreEqual(0, dirtyFlagMap.Count); }
public void TestKeySetClear() { DirtyFlagMap dirtyFlagMap = new DirtyFlagMap(); ISet keySet = dirtyFlagMap.KeySet(); keySet.Clear(); Assert.IsFalse(dirtyFlagMap.Dirty); dirtyFlagMap.Put("a", "Y"); dirtyFlagMap.ClearDirtyFlag(); keySet.Clear(); Assert.IsTrue(dirtyFlagMap.Dirty); Assert.AreEqual(0, dirtyFlagMap.Count); }
public void TestEntrySetRemove() { DirtyFlagMap dirtyFlagMap = new DirtyFlagMap(); ISet entrySet = dirtyFlagMap.EntrySet(); dirtyFlagMap.Remove("a"); Assert.IsFalse(dirtyFlagMap.Dirty); dirtyFlagMap.Put("a", "Y"); dirtyFlagMap.ClearDirtyFlag(); entrySet.Remove("b"); Assert.IsFalse(dirtyFlagMap.Dirty); entrySet.Remove(entrySet.First()); Assert.IsTrue(dirtyFlagMap.Dirty); }
public void TestEntrySetIterator() { DirtyFlagMap dirtyFlagMap = new DirtyFlagMap(); ISet entrySet = dirtyFlagMap.EntrySet(); dirtyFlagMap.Put("a", "A"); dirtyFlagMap.Put("b", "B"); dirtyFlagMap.Put("c", "C"); dirtyFlagMap.ClearDirtyFlag(); DictionaryEntry entryToBeRemoved = (DictionaryEntry)entrySet.First(); string removedKey = (string)entryToBeRemoved.Key; entrySet.Remove(entryToBeRemoved); Assert.AreEqual(2, dirtyFlagMap.Count); Assert.IsTrue(dirtyFlagMap.Dirty); Assert.IsFalse(dirtyFlagMap.Contains(removedKey)); dirtyFlagMap.ClearDirtyFlag(); DictionaryEntry entry = (DictionaryEntry)entrySet.First(); entry.Value = "BB"; Assert.IsTrue(dirtyFlagMap.Dirty); Assert.IsTrue(dirtyFlagMap.ContainsValue("BB")); }
public void TestEntrySetToArrayWithArg() { DirtyFlagMap dirtyFlagMap = new DirtyFlagMap(); ISet entrySet = dirtyFlagMap.EntrySet(); dirtyFlagMap.Put("a", "A"); dirtyFlagMap.Put("b", "B"); dirtyFlagMap.Put("c", "C"); dirtyFlagMap.ClearDirtyFlag(); object[] array = (object[])new ArrayList(entrySet).ToArray(typeof(DictionaryEntry)); Assert.AreEqual(3, array.Length); DictionaryEntry entry = (DictionaryEntry)array[0]; entry.Value = "BB"; Assert.IsTrue(dirtyFlagMap.Dirty); Assert.IsTrue(dirtyFlagMap.ContainsValue("BB")); }