Exemple #1
0
        public void GetDirection_WhenPannedIn2Directions_ReturnsDirectionTypeBasedOnMoreExtremeCoordinate()
        {
            //arrange
            var           sut = new DragReader();
            MoveDirection leftResponse;
            MoveDirection rightResponse;
            MoveDirection topResponse;
            MoveDirection bottomResponse;

            //act
            sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Started, 0, -100, 80));
            leftResponse = sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Completed, 0, 0, 0));

            sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Started, 0, 100, -80));
            rightResponse = sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Completed, 0, 0, 0));

            sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Started, 0, 80, -100));
            topResponse = sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Completed, 0, 0, 0));

            sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Started, 0, 80, 100));
            bottomResponse = sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Completed, 0, 0, 0));
            //assert
            Assert.That(leftResponse == MoveDirection.Left);
            Assert.That(rightResponse == MoveDirection.Right);
            Assert.That(topResponse == MoveDirection.Top);
            Assert.That(bottomResponse == MoveDirection.Bottom);
        }
Exemple #2
0
        public void GetDirection_WhenPannedTop_ReturnsTopMoveDirectionType()
        {
            //arrange
            var           sut = new DragReader();
            MoveDirection response;

            //act
            sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Started, 0, 0, -500));
            response = sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Completed, 0, 0, 0));
            //assert
            Assert.That(response == MoveDirection.Top);
        }
Exemple #3
0
        public void GetDirection_WhenTooShortPanPerformed_ReturnsNoneMoveDirectionType()
        {
            //arrange
            var           sut = new DragReader();
            MoveDirection response;

            //act
            sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Started, 0, 12, 16));
            response = sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Completed, 0, 0, 0));
            //assert
            Assert.That(response == MoveDirection.None);
        }
Exemple #4
0
        public void GetDirection_WhenInCompletedGestureStatusGiven_ReturnsNoneMoveDirectionType()
        {
            //arrange
            var sut = new DragReader();
            List <MoveDirection> responses = new List <MoveDirection>();

            //act
            responses.Add(sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Canceled, 0)));
            responses.Add(sut.GetDirection(new PanUpdatedEventArgs(GestureStatus.Canceled, 0)));
            //assert
            Assert.That(responses.Where(x => x == MoveDirection.None).Count() == responses.Count);
        }