Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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"));
        }
Пример #4
0
        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"));
        }