diff options
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/SwitchUnitTests.cs')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/SwitchUnitTests.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/SwitchUnitTests.cs b/Xamarin.Forms.Core.UnitTests/SwitchUnitTests.cs new file mode 100644 index 00000000..9748c3e9 --- /dev/null +++ b/Xamarin.Forms.Core.UnitTests/SwitchUnitTests.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using NUnit.Framework; + +namespace Xamarin.Forms.Core.UnitTests +{ + [TestFixture] + public class SwitchUnitTests : BaseTestFixture + { + [Test] + public void TestConstructor () + { + Switch sw = new Switch (); + + Assert.IsFalse (sw.IsToggled); + } + + [Test] + public void TestOnEvent () + { + Switch sw = new Switch (); + + bool fired = false; + sw.Toggled += (sender, e) => fired = true; + + sw.IsToggled = true; + + Assert.IsTrue (fired); + } + + [Test] + public void TestOnEventNotDoubleFired () + { + var sw = new Switch (); + + bool fired = false; + sw.IsToggled = true; + + sw.Toggled += (sender, args) => fired = true; + sw.IsToggled = true; + + Assert.IsFalse (fired); + } + } + +} |