public void DistanceChangedCalculator_Calculate_Test_For_Distance() { //Setup preamble for 2 touchpoints to be used in calculate TouchInfo ti1 = new TouchInfo(); ti1.TouchDeviceId = 2; ti1.ActionType = TouchAction2.Down; ti1.Position = new Point(1, 5); TouchInfo ti2 = new TouchInfo(); ti2.TouchDeviceId = 2; ti2.ActionType = TouchAction2.Down; ti2.Position = new Point(2, 6); ValidSetOfTouchPoints test = new ValidSetOfTouchPoints(); test.Add(new TouchPoint2(ti1, new UIElement())); test.Add(new TouchPoint2(ti2, new UIElement())); //Call appropriate methods DistanceChangedCalculator target = new DistanceChangedCalculator(); DistanceChanged result = target.Calculate(test) as DistanceChanged; result.Distance = Math.Round(result.Distance, 2); bool actual = result.Distance.Equals(1.41); Assert.AreEqual(true, actual); }
public void DistanceChangedCalculator_Calculate_Test_With_Low_Counts() { //Setup preamble for 2 touchpoints to be used in calculate TouchInfo ti1 = new TouchInfo(); ti1.TouchDeviceId = 2; ti1.ActionType = TouchAction2.Down; ti1.Position = new Point(1, 5); TouchInfo ti2 = new TouchInfo(); ti2.TouchDeviceId = 2; ti2.ActionType = TouchAction2.Down; ti2.Position = new Point(2, 6); ValidSetOfTouchPoints test = new ValidSetOfTouchPoints(); test.Add(new TouchPoint2(ti1, new UIElement())); test.Add(new TouchPoint2(ti2, new UIElement())); //Call appropriate methods DistanceChangedCalculator target = new DistanceChangedCalculator(); DistanceChanged result = target.Calculate(test) as DistanceChanged; Assert.IsTrue(result.Delta == 0); }
public void DistanceChangedCalculator_Calculate_Test_With_1_Input() { DistanceChangedCalculator target = new DistanceChangedCalculator(); TouchPoint2 t2 = new TouchPoint2(new TouchInfo(), new System.Windows.UIElement()); ValidSetOfTouchPoints set = new ValidSetOfTouchPoints(); set.Add(t2); target.Calculate(set); }
public void DistanceChangedCalculator_Calculate_Test_With_Null_Input() { DistanceChangedCalculator target = new DistanceChangedCalculator(); ValidSetOfTouchPoints set = null; target.Calculate(set); }