public void PromoteMovesItemToTheTopOfTheListAndDoesNotChangeTheSelectedItem()
        {
            list.SaveServer(new Server("1.2.3.4", 5678), "SAVED FIRST");
            list.SaveProfile(@"X:\path\to\some.DayZProfile");
            list.SaveServer(new Server("5.6.7.8", 4321), "SAVED SECOND");
            comboBox.SelectedIndex = 2;

            ServerSelectionItem item = list.Promote(3);

            Assert.AreEqual(3, comboBox.SelectedIndex);

            Assert.AreEqual(5, list.Count);
            Assert.AreEqual("Most Recent (Stable)", list[0].DisplayName);
            Assert.AreEqual("Most Recent (Experimental)", list[1].DisplayName);
            Assert.AreEqual(@"Most Recent (X:\path\to\some.DayZProfile)", list[2].DisplayName);
            Assert.AreEqual("SAVED SECOND (5.6.7.8:4321)", list[3].DisplayName);
            Assert.AreEqual("SAVED FIRST (1.2.3.4:5678)", list[4].DisplayName);

            Assert.AreEqual(list[2], item);
        }
Ejemplo n.º 2
0
        private void ServerSelectionChanged(object sender, EventArgs e)
        {
            removeSelectedServer.Enabled = serverList.IndexRemovable(
                SelectionCombo.SelectedIndex);

            ServerSelectionItem item = serverList[SelectionCombo.SelectedIndex];

            if (item != null)
            {
                serverList.Promote(SelectionCombo.SelectedIndex);
                UpdateServerSource(item.GetSource());
            }
        }