Beispiel #1
0
 public void TestInsertText()
 {
     MockEditor med = new MockEditor();
     bool shouldNotRaiseEvent = true;
     bool eventFired = false;
     med.TextChanged +=
         new EventHandler<TextChangedEventArgs>(delegate(object sender, TextChangedEventArgs e) {
             Assert.IsFalse(shouldNotRaiseEvent);
             Assert.AreEqual(3, e.Length);
             Assert.AreEqual("Kat", e.Text);
             Assert.AreEqual(0, e.Start);
             Assert.AreEqual(TextChangedEventArgs.OperationType.Insertion,
                             e.Operation);
             eventFired = true;
         });
     med.InsertText(0, "Ana are mere.", true);
     shouldNotRaiseEvent = false;
     Assert.IsFalse(eventFired);
     med.InsertText(0, "Kat", false);
     Assert.IsTrue(eventFired);
     Assert.AreEqual("KatAna are mere.", med.GetText(0, med.Length));
 }
Beispiel #2
0
 private MockEditor SetupMockEditor(string text)
 {
     MockEditor result = new MockEditor();
     result.SimulateInsertText(text);
     result.CursorOffset = 0;
     return result;
 }
Beispiel #3
0
 public void TestSimulateInsertText()
 {
     MockEditor med = new MockEditor();
     Assert.AreEqual(String.Empty, med.GetText(0, med.Length));
     string testString = "Ana are mere.";
     med.SimulateInsertText(testString);
     Assert.AreEqual(testString, med.GetText(0, med.Length));
 }