private void btnMoveOnly1_Click(object sender, EventArgs e)
        {
            _mainFormListMaker.BeginUpdate();

            foreach (string a in lbNo1.Items)
            {
                _mainFormListMaker.Add(a);
            }

            _mainFormListMaker.EndUpdate();
        }
Exemplo n.º 2
0
        private void AddListToListMaker(ListMaker lm, IEnumerable <Article> lb)
        {
            List <Article> articles = new List <Article>();

            articles.AddRange(lb);
            lm.Add(articles);
        }
Exemplo n.º 3
0
        public void RemoveListDuplicatesSimple()
        {
            ListMaker LMakerRLD = new ListMaker();
            LMakerRLD.Add(new Article("A"));
            LMakerRLD.Add(new Article("B"));
            LMakerRLD.Add(new Article("C"));
            LMakerRLD.Add(new Article("A"));

            LMakerRLD.RemoveListDuplicates();

            Assert.AreEqual(LMakerRLD.Count, 3, "Duplicate removed");
            foreach(Article a in LMakerRLD)
            {
                Assert.AreEqual(a, "A", "Duplicates removed from end of list");
                break;
            }
        }
Exemplo n.º 4
0
        public void RemoveListDuplicates10K()
        {
            const int big = 10000;
            ListMaker LMakerLarge = new ListMaker();
            LMakerLarge.Clear();
            for(int i=1; i<big; i++)
                LMakerLarge.Add(new Article(i.ToString()));

            LMakerLarge.Add(new Article("1"));

            Assert.AreEqual(LMakerLarge.Count, big);

            LMakerLarge.RemoveListDuplicates();

            Assert.AreEqual(LMakerLarge.Count, big-1, "Duplicate removed");
            Assert.IsTrue(LMakerLarge.Contains(new Article("1")), "First instance of article retained");
        }
Exemplo n.º 5
0
        public void GetArticleList()
        {
            ListMaker LMaker = new ListMaker();
            LMaker.Add("A");
            LMaker.Add("B");

            Assert.AreEqual(2, LMaker.GetArticleList().Count);

            LMaker.Items.SetSelected(0, true);
            LMaker.Items.SetSelected(1, true);

            Assert.AreEqual(2, LMaker.GetSelectedArticleList().Count);

            LMaker.Items.SetSelected(1, false);

            Assert.AreEqual(1, LMaker.GetSelectedArticleList().Count);
            Assert.AreEqual(2, LMaker.GetArticleList().Count);
        }
Exemplo n.º 6
0
        public void FilterNonMainArticlesVolume()
        {
            const int big = 500;
            ListMaker LMakerLarge = new ListMaker();
            LMakerLarge.Clear();
            for(int i=1; i<big; i++)
                LMakerLarge.Add(i.ToString());

            LMakerLarge.Add("Talk:Me");

            LMakerLarge.FilterNonMainArticles();
            Assert.AreEqual(LMakerLarge.Count, big-1, "Non-mainspace article removed");
        }
Exemplo n.º 7
0
        public void FilterNonMainArticles()
        {
            ListMaker LMaker = new ListMaker();
            LMaker.Add("One");
            LMaker.Add("Two");
            LMaker.Add("Talk:Three");
            LMaker.Add("Four");
            LMaker.Add("Talk:Five");
            LMaker.Add("Talk:Five2");
            LMaker.Add("Six");

            LMaker.FilterNonMainArticles();
            Assert.AreEqual(4, LMaker.NumberOfArticles);
        }
Exemplo n.º 8
0
        public void AddList()
        {
            ListMaker LMaker = new ListMaker();
            List<Article> l = new List<Article>();

            l.Add(new Article("A"));
            l.Add(new Article("B"));

            LMaker.Add("A");
            LMaker.Add("B");

            LMaker.FilterDuplicates = true;

            LMaker.Add(l);
            Assert.AreEqual(2, LMaker.NumberOfArticles);

            l.Add(new Article("C"));
            LMaker.Add(l);
            Assert.AreEqual(3, LMaker.NumberOfArticles);

            l.Add(new Article("C"));
            l.Add(new Article("C"));
            l.Add(new Article("C"));
            l.Add(new Article("C"));
            LMaker.Add("D");
            LMaker.Add(l);
            Assert.AreEqual(4, LMaker.NumberOfArticles);
        }
Exemplo n.º 9
0
        public void ListComparerSimple()
        {
            ListMaker LMaker = new ListMaker();
            LMaker.Add(new Article("A"));
            LMaker.Add(new Article("B"));
            LMaker.Add(new Article("C"));
            LMaker.Add(new Article("C")); // duplicate, removed during compare
            System.Windows.Forms.ListBox lb1 = new System.Windows.Forms.ListBox();
            System.Windows.Forms.ListBox lb2 = new System.Windows.Forms.ListBox();
            System.Windows.Forms.ListBox lb3 = new System.Windows.Forms.ListBox();

            List<Article> articles = new List<Article>();
            articles.Add(new Article("A"));
            articles.Add(new Article("D"));
            articles.Add(new Article("E"));

            ListComparer.CompareLists(LMaker, articles, lb1, lb2, lb3);

            // unique in 1
            Assert.IsTrue(lb1.Items.Contains("B"));
            Assert.IsTrue(lb1.Items.Contains("C"));
            Assert.IsFalse(lb1.Items.Contains("A"));
            Assert.AreEqual(lb1.Items.Count, 2);

            // unique in 2
            Assert.IsFalse(lb2.Items.Contains("A"));
            Assert.IsTrue(lb2.Items.Contains("D"));
            Assert.IsTrue(lb2.Items.Contains("E"));
            Assert.AreEqual(lb2.Items.Count, 2);

            // common to both
            Assert.IsTrue(lb3.Items.Contains("A"));
            Assert.AreEqual(lb3.Items.Count, 1);
        }
Exemplo n.º 10
0
        public void ListComparer10K()
        {
            const int big = 10000;
            ListMaker LMakerC10K = new ListMaker();

            for(int i=0; i<big; i++)
                LMakerC10K.Add(new Article(i.ToString()));

            LMakerC10K.Add(new Article("A"));
            LMakerC10K.Add(new Article("B"));

            System.Windows.Forms.ListBox lb1 = new System.Windows.Forms.ListBox();
            System.Windows.Forms.ListBox lb2 = new System.Windows.Forms.ListBox();
            System.Windows.Forms.ListBox lb3 = new System.Windows.Forms.ListBox();

            List<Article> articlesC = new List<Article>();
            for(int i=0; i<big; i++)
                articlesC.Add(new Article(i.ToString()));

            articlesC.Add(new Article("C"));
            articlesC.Add(new Article("D"));

            ListComparer.CompareLists(LMakerC10K, articlesC, lb1, lb2, lb3);

            // unique in 1
            Assert.IsTrue(lb1.Items.Contains("A"));
            Assert.IsTrue(lb1.Items.Contains("B"));

            // unique in 2
            Assert.IsTrue(lb2.Items.Contains("C"));
            Assert.IsTrue(lb2.Items.Contains("D"));

            // common to both
            Assert.IsTrue(lb3.Items.Contains("1"));
            Assert.AreEqual(lb3.Items.Count, big);
        }
Exemplo n.º 11
0
 private void AddListToListMaker(ListMaker lm, IEnumerable<Article> lb)
 {
     List<Article> articles = new List<Article>();
     articles.AddRange(lb);
     lm.Add(articles);
 }