summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests/EditorTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/EditorTests.cs')
-rw-r--r--Xamarin.Forms.Core.UnitTests/EditorTests.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/EditorTests.cs b/Xamarin.Forms.Core.UnitTests/EditorTests.cs
new file mode 100644
index 00000000..c16f1d2a
--- /dev/null
+++ b/Xamarin.Forms.Core.UnitTests/EditorTests.cs
@@ -0,0 +1,34 @@
+using NUnit.Framework;
+
+namespace Xamarin.Forms.Core.UnitTests
+{
+ [TestFixture]
+ public class EditorTests : BaseTestFixture
+ {
+ [TestCase ("Hi", "My text has changed")]
+ [TestCase (null, "My text has changed")]
+ [TestCase ("Hi", null)]
+ public void EditorTextChangedEventArgs (string initialText, string finalText)
+ {
+ var editor = new Editor {
+ Text = initialText
+ };
+
+ Editor editorFromSender = null;
+ string oldText = null;
+ string newText = null;
+
+ editor.TextChanged += (s, e) => {
+ editorFromSender = (Editor)s;
+ oldText = e.OldTextValue;
+ newText = e.NewTextValue;
+ };
+
+ editor.Text = finalText;
+
+ Assert.AreEqual (editor, editorFromSender);
+ Assert.AreEqual (initialText, oldText);
+ Assert.AreEqual (finalText, newText);
+ }
+ }
+}