summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests/TapGestureRecognizerTests.cs
blob: 5b639b2c781a98078919540fecd7c0a9e466c45e (plain)
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
using System;
using NUnit.Framework;

namespace Xamarin.Forms.Core.UnitTests
{
	[TestFixture]
	public class TapGestureRecognizerTests : BaseTestFixture
	{
		[Test]
		public void Constructor ()
		{
			var tap = new TapGestureRecognizer ();

			Assert.AreEqual (null, tap.Command);
			Assert.AreEqual (null, tap.CommandParameter);
			Assert.AreEqual (1, tap.NumberOfTapsRequired);
		}

		[Test]
		public void CallbackPassesParameter ()
		{
			var view = new View ();
			var tap = new TapGestureRecognizer ();
			tap.CommandParameter = "Hello";

			object result = null;
			tap.Command = new Command (o => result = o);

			tap.SendTapped (view);
			Assert.AreEqual (result, tap.CommandParameter);
		}
	}
}