diff options
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/KeyboardTests.cs')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/KeyboardTests.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/KeyboardTests.cs b/Xamarin.Forms.Core.UnitTests/KeyboardTests.cs new file mode 100644 index 00000000..773f0903 --- /dev/null +++ b/Xamarin.Forms.Core.UnitTests/KeyboardTests.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using NUnit.Framework; + +namespace Xamarin.Forms.Core.UnitTests +{ + [TestFixture] + internal class KeyboardTests : BaseTestFixture + { + [Test] + public void KeyboardTypesAreCorrect () + { + Assert.True (Keyboard.Chat is ChatKeyboard); + Assert.True (Keyboard.Email is EmailKeyboard); + Assert.True (Keyboard.Numeric is NumericKeyboard); + Assert.True (Keyboard.Telephone is TelephoneKeyboard); + Assert.True (Keyboard.Text is TextKeyboard); + Assert.True (Keyboard.Url is UrlKeyboard); + } + } + + [TestFixture] + internal class KeyboardTypeConverterTests : BaseTestFixture + { + [Test] + public void ConversionConvert () + { + + var converter = new KeyboardTypeConverter (); + Assert.True (converter.CanConvertFrom (typeof(string))); + foreach (var kvp in new Dictionary<string, Keyboard> { + {"Keyboard.Default", Keyboard.Default}, + {"Keyboard.Email", Keyboard.Email}, + {"Keyboard.Text", Keyboard.Text}, + {"Keyboard.Url", Keyboard.Url}, + {"Keyboard.Telephone", Keyboard.Telephone}, + {"Keyboard.Chat", Keyboard.Chat}, + }) + Assert.AreSame (kvp.Value, converter.ConvertFromInvariantString (kvp.Key)); + } + + [Test] + public void ConversionFail () + { + var converter = new KeyboardTypeConverter (); + Assert.Throws<InvalidOperationException> (() => converter.ConvertFromInvariantString ("Foo")); + } + } +}
\ No newline at end of file |