public void TitleTest() { CommandBar_Accessor target = new CommandBar_Accessor(); string expected = string.Empty; target.Title = expected; Assert.AreEqual(expected, target.Title); Assert.AreEqual(expected + ">", target.cmdLabel.Text); expected = "text"; target.Title = expected; Assert.AreEqual(expected, target.Title); Assert.AreEqual(expected + ">", target.cmdLabel.Text); expected = @"c:\"; target.Title = expected; Assert.AreEqual(expected, target.Title); Assert.AreEqual(expected + ">", target.cmdLabel.Text); }
public void TextTest() { CommandBar_Accessor target = new CommandBar_Accessor(); string expected = string.Empty; target.Text = expected; Assert.AreEqual(expected, target.Text); Assert.AreEqual(expected, target.cmdComboBox.Text); expected = "item1"; target.Text = expected; Assert.AreEqual(expected, target.Text); Assert.AreEqual(expected, target.cmdComboBox.Text); expected = "item2"; target.Text = expected; Assert.AreEqual(expected, target.Text); Assert.AreEqual(expected, target.cmdComboBox.Text); }
public void StoryCurrentTextTest() { CommandBar_Accessor target = new CommandBar_Accessor(); string expected1 = "cd c:"; target.Text = expected1; target.StoryCurrentText(); Assert.AreEqual(1, target.cmdComboBox.Items.Count); Assert.AreEqual(expected1, target.cmdComboBox.Items[0]); string expected2 = "cd d:"; target.Text = expected2; target.StoryCurrentText(); Assert.AreEqual(2, target.cmdComboBox.Items.Count); Assert.AreEqual(expected2, target.cmdComboBox.Items[0]); Assert.AreEqual(expected1, target.cmdComboBox.Items[1]); target.Text = expected1; target.StoryCurrentText(); Assert.AreEqual(2, target.cmdComboBox.Items.Count); Assert.AreEqual(expected1, target.cmdComboBox.Items[0]); Assert.AreEqual(expected2, target.cmdComboBox.Items[1]); string expected3 = "cd e:"; target.Text = expected3; target.StoryCurrentText(); Assert.AreEqual(3, target.cmdComboBox.Items.Count); Assert.AreEqual(expected3, target.cmdComboBox.Items[0]); Assert.AreEqual(expected1, target.cmdComboBox.Items[1]); Assert.AreEqual(expected2, target.cmdComboBox.Items[2]); }
public void OnLinesChangedTest() { CommandBar_Accessor target = new CommandBar_Accessor(); bool actual = false; target.add_LinesChanged(delegate(object sender, EventArgs args) { actual = true; }); target.OnLinesChanged(EventArgs.Empty); Assert.IsTrue(actual); actual = false; target.Lines = "item1\r\nitem2"; Assert.IsTrue(actual); actual = false; target.Lines = "item1\r\nitem2"; Assert.IsFalse(actual); }
public void LinesTest() { CommandBar_Accessor target = new CommandBar_Accessor(); target.Lines = "item1\r\nitem2"; Assert.AreEqual("item1\r\nitem2", target.Lines); Assert.AreEqual(2, target.cmdComboBox.Items.Count); Assert.AreEqual("item1", target.cmdComboBox.Items[0]); Assert.AreEqual("item2", target.cmdComboBox.Items[1]); target.Lines = "item1\r\nitem2\r\n"; Assert.AreEqual("item1\r\nitem2", target.Lines); Assert.AreEqual(2, target.cmdComboBox.Items.Count); Assert.AreEqual("item1", target.cmdComboBox.Items[0]); Assert.AreEqual("item2", target.cmdComboBox.Items[1]); target.Lines = "item1\r\nitem2\r\n\r\n"; Assert.AreEqual("item1\r\nitem2", target.Lines); Assert.AreEqual(2, target.cmdComboBox.Items.Count); Assert.AreEqual("item1", target.cmdComboBox.Items[0]); Assert.AreEqual("item2", target.cmdComboBox.Items[1]); target.Lines = string.Empty; Assert.AreEqual(0, target.cmdComboBox.Items.Count); target.Lines = "item1\r\nitem2\r\nitem3\r\n"; Assert.AreEqual("item1\r\nitem2\r\nitem3", target.Lines); Assert.AreEqual(3, target.cmdComboBox.Items.Count); Assert.AreEqual("item1", target.cmdComboBox.Items[0]); Assert.AreEqual("item2", target.cmdComboBox.Items[1]); Assert.AreEqual("item3", target.cmdComboBox.Items[2]); }