public void SingleSelectBox() { Form form = new ListBoxTestForm(); form.Show(); TestWriter writer = new TestWriter(form); Assert.AreEqual("", writer.Test); ListBoxTester myListBox = new ListBoxTester("mySingleSelectBox", form); myListBox.ClearSelected(); myListBox.SetSelected(0, true); //Red myListBox.SetSelected(2, true); //Yellow myListBox.SetSelected(4, true); //Blue myListBox.SetSelected(6, true); //Violet Assert.AreEqual( @"[Test] public void Test() { ListBoxTester mySingleSelectBox = new ListBoxTester(""mySingleSelectBox""); mySingleSelectBox.Select(0); //Can mySingleSelectBox.Select(2); //Select mySingleSelectBox.Select(4); //At mySingleSelectBox.Select(6); //Time }", writer.Test); }
public void ListBoxSelection() { LabelTester myLabel = new LabelTester("myLabel"); ListBoxTester myListBox = new ListBoxTester("myListBox"); myListBox.ClearSelected(); myListBox.Select(rainbowArray[0]); Assert.AreEqual(rainbowArray[0], myLabel.Text); }
public void MutlipleSelection() { Form form = new ListBoxTestForm(); form.Show(); TestWriter writer = new TestWriter(form); Assert.AreEqual("", writer.Test); ListBoxTester myListBox = new ListBoxTester("myListBox", form); myListBox.ClearSelected(); myListBox.SetSelected(0, true); //Red myListBox.SetSelected(2, true); //Yellow myListBox.SetSelected(4, true); //Blue myListBox.SetSelected(6, true); //Violet Assert.AreEqual( @"[Test] public void Test() { ListBoxTester myListBox = new ListBoxTester(""myListBox""); myListBox.ClearSelected(); myListBox.SetSelected(0, True); //Red myListBox.ClearSelected(); myListBox.SetSelected(0, True); //Red myListBox.SetSelected(2, True); //Yellow myListBox.ClearSelected(); myListBox.SetSelected(0, True); //Red myListBox.SetSelected(2, True); //Yellow myListBox.SetSelected(4, True); //Blue myListBox.ClearSelected(); myListBox.SetSelected(0, True); //Red myListBox.SetSelected(2, True); //Yellow myListBox.SetSelected(4, True); //Blue myListBox.SetSelected(6, True); //Violet }", writer.Test); }
public void ListBoxMultiSelection() { ListBoxTester myListBox = new ListBoxTester("myListBox"); string[] alternateColors = new string[] {"Red", "Yellow", "Blue", "Violet"}; StringCollection alternates = new StringCollection(); alternates.AddRange(alternateColors); myListBox.ClearSelected(); foreach(string color in alternates) { myListBox.SetSelected(color, true); } Assert.AreEqual(4, myListBox.Properties.SelectedItems.Count); foreach(object selectedItem in myListBox.Properties.SelectedItems) { Assert.IsTrue(alternates.Contains(Convert.ToString(selectedItem))); } }
public void ListBoxMultiSelection() { ListBoxTester myListBox = new ListBoxTester("myListBox"); string[] alternateColors = new string[] { "Red", "Yellow", "Blue", "Violet" }; StringCollection alternates = new StringCollection(); alternates.AddRange(alternateColors); myListBox.ClearSelected(); foreach (string color in alternates) { myListBox.SetSelected(color, true); } Assert.AreEqual(4, myListBox.Properties.SelectedItems.Count); foreach (object selectedItem in myListBox.Properties.SelectedItems) { Assert.IsTrue(alternates.Contains(Convert.ToString(selectedItem))); } }