Esempio n. 1
0
        public void itShouldAddItemsByFIFO()
        {
            var mruList = new MRUList <string>();

            mruList.AddItem("a");
            mruList.AddItem("b");
            mruList.AddItem("c");
            mruList.AddItem("d");

            Assert.AreEqual(4, mruList.Items.Count);
            Assert.AreEqual("d", mruList.Items[0]);
            Assert.AreEqual("c", mruList.Items[1]);
            Assert.AreEqual("b", mruList.Items[2]);
            Assert.AreEqual("a", mruList.Items[3]);
        }
Esempio n. 2
0
        public void itShouldLimitByMaxItemsWhenGiven()
        {
            var maxItems = 3;
            var mruList  = new MRUList <string>(maxItems);

            mruList.AddItem("a");
            mruList.AddItem("b");
            mruList.AddItem("c");
            mruList.AddItem("d");

            Assert.AreEqual(maxItems, mruList.Items.Count);
            Assert.AreEqual("d", mruList.Items[0]);
            Assert.AreEqual("c", mruList.Items[1]);
            Assert.AreEqual("b", mruList.Items[2]);
        }
Esempio n. 3
0
        public void itShouldPutExistingItemToFirstSlotWhenAddedAgain()
        {
            var mruList = new MRUList <string>();

            mruList.AddItem("a");
            mruList.AddItem("b");
            mruList.AddItem("c");
            mruList.AddItem("a");

            Assert.AreEqual(3, mruList.Items.Count);
            Assert.AreEqual("a", mruList.Items[0]);
            Assert.AreEqual("c", mruList.Items[1]);
            Assert.AreEqual("b", mruList.Items[2]);

            mruList.AddItem("b");
            Assert.AreEqual(3, mruList.Items.Count);
            Assert.AreEqual("b", mruList.Items[0]);
            Assert.AreEqual("a", mruList.Items[1]);
            Assert.AreEqual("c", mruList.Items[2]);

            mruList.AddItem("c");
            Assert.AreEqual(3, mruList.Items.Count);
            Assert.AreEqual("c", mruList.Items[0]);
            Assert.AreEqual("b", mruList.Items[1]);
            Assert.AreEqual("a", mruList.Items[2]);
        }
Esempio n. 4
0
 private void OpenFile(string fname)
 {
     try
     {
         var tl = new OWTypeLib(fname);
         var tp = new TabPage(tl.ShortName);
         tp.ImageIndex = 0;
         var wc = new Wooctrl(imglstTreeNodes, imgListMisc, tl);
         tp.Controls.Add(wc);
         tp.Tag  = tl;
         wc.Dock = DockStyle.Fill;
         tcTypeLibs.TabPages.Add(tp);
         _mrufiles.AddItem(fname);
         _mrufiles.Flush();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error:", MessageBoxButtons.OK);
     }
 }