Example #1
0
 public void TestIndexerSet()
 {
     var list = new List<string> { "aaa", "bbb", "ccc" };
     var set = new ObservableSet<string>(list) { [1] = "ddd" };
     Assert.AreEqual(set.Count, 3);
     Assert.That(set.Contains("aaa"));
     Assert.That(set.Contains("ddd"));
     Assert.That(set.Contains("ccc"));
 }
Example #2
0
 public void TestEnumerableConstructorWithDuplicate()
 {
     var list = new List<string> { "aaa", "bbb", "ccc", "bbb" };
     var set = new ObservableSet<string>(list);
     Assert.AreEqual(set.Count, 3);
     Assert.That(set.Contains("aaa"));
     Assert.That(set.Contains("bbb"));
     Assert.That(set.Contains("ccc"));
 }
        public void TestEnumerableConstructorWithDuplicate()
        {
            var list = new List <string> {
                "aaa", "bbb", "ccc", "bbb"
            };
            var set = new ObservableSet <string>(list);

            Assert.AreEqual(set.Count, 3);
            Assert.That(set.Contains("aaa"));
            Assert.That(set.Contains("bbb"));
            Assert.That(set.Contains("ccc"));
        }
        public void TestContains()
        {
            var list = new List <string> {
                "aaa", "bbb", "ccc"
            };
            var set = new ObservableSet <string>(list);

            Assert.That(set.Contains("aaa"));
            Assert.That(set.Contains("bbb"));
            Assert.That(set.Contains("ccc"));
            Assert.That(!set.Contains("ddd"));
        }
        public void TestIndexerSet()
        {
            var list = new List <string> {
                "aaa", "bbb", "ccc"
            };
            var set = new ObservableSet <string>(list)
            {
                [1] = "ddd"
            };

            Assert.AreEqual(set.Count, 3);
            Assert.That(set.Contains("aaa"));
            Assert.That(set.Contains("ddd"));
            Assert.That(set.Contains("ccc"));
        }
Example #6
0
        public void add_should_work()
        {
            var observableSet = new ObservableSet <int>();

            observableSet.Add(1);
            observableSet.Contains(1).Should().Be.True();
        }
Example #7
0
        public static void ContainsTest()
        {
            string[] anArray = new string[] { "one", "two", "three", "four" };
            ObservableSet <string> collection = new ObservableSet <string>((IEnumerable <string>)anArray);
            string collectionString           = "";

            foreach (var item in collection)
            {
                collectionString += item + ", ";
            }

            for (int i = 0; i < collection.Count; ++i)
            {
                Assert.True(collection.Contains(anArray[i]), "ObservableCollection did not contain the item: " + anArray[i] + " Collection: " + collectionString);
            }

            string g = "six";

            Assert.False(collection.Contains(g), "Collection contained an item that should not have been there. guid: " + g + " Collection: " + collectionString);
            Assert.False(collection.Contains(null), "Collection should not have contained null. Collection: " + collectionString);
        }
Example #8
0
            /// <summary>
            /// Commits the changes to the <see cref="ActivePluginLog"/>.
            /// </summary>
            public void Commit()
            {
                lock (EnlistedPluginLog.m_ostActivePlugins)
                {
                    EnlistedPluginLog.m_ostActivePlugins.CollectionChanged -= MasterPlugins_CollectionChanged;
                    foreach (Plugin plgNew in m_ostActivePlugins)
                    {
                        EnlistedPluginLog.m_ostActivePlugins.Add(plgNew);
                    }
                    for (Int32 i = EnlistedPluginLog.m_ostActivePlugins.Count - 1; i >= 0; i--)
                    {
                        if (!m_ostActivePlugins.Contains(EnlistedPluginLog.m_ostActivePlugins[i]))
                        {
                            EnlistedPluginLog.m_ostActivePlugins.RemoveAt(i);
                        }
                    }
                }
                EnlistedPluginLog.SavePluginLog();

                m_booEnlisted = false;
                m_ostActivePlugins.Clear();;
            }
        public bool IsPluginActive(string p_strPath)
        {
            string temp = Path.GetFileName(p_strPath);

            return(m_Plugins.Contains(p => Path.GetFileName(p.Filename) == temp.ToLower()));
        }
Example #10
0
 public void TestContains()
 {
     var list = new List<string> { "aaa", "bbb", "ccc" };
     var set = new ObservableSet<string>(list);
     Assert.That(set.Contains("aaa"));
     Assert.That(set.Contains("bbb"));
     Assert.That(set.Contains("ccc"));
     Assert.That(!set.Contains("ddd"));
 }