/
EditorTests.cs
48 lines (42 loc) · 1.11 KB
/
EditorTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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);
}
[TestCase(true)]
public void IsReadOnlyTest(bool isReadOnly)
{
Editor editor = new Editor();
editor.SetValue(InputView.IsReadOnlyProperty, isReadOnly);
Assert.AreEqual(isReadOnly, editor.IsReadOnly);
}
[Test]
public void IsReadOnlyDefaultValueTest()
{
Editor editor = new Editor();
Assert.AreEqual(editor.IsReadOnly, false);
}
}
}