public void GetAverageVelocity_Various(Vector2[] velocityStack, Vector2 expectedVelocity)
    {
        IPointerDownInputStateConstArg arg   = CreateMockArg();
        TestAbsPointerDownInputState   state = new TestAbsPointerDownInputState(arg);

        state.SetVelocityStack_Test(velocityStack);

        Assert.That(state.GetAvarageVelocity_Test(), Is.EqualTo(expectedVelocity));
    }
    public void PushVelocityStack_UpdatesVelocityStack(Vector2[] addedVelocity, Vector2[] expectedStack)
    {
        IPointerDownInputStateConstArg arg   = CreateMockArg();
        TestAbsPointerDownInputState   state = new TestAbsPointerDownInputState(arg);

        foreach (Vector2 velocity in addedVelocity)
        {
            state.PushVelocityStack_Test(velocity);
        }

        Assert.That(state.GetVelocityStack_Test(), Is.EqualTo(expectedStack));
    }
    public void OnEnter_ClearsVelocityStack()
    {
        IPointerDownInputStateConstArg arg   = CreateMockArg();
        TestAbsPointerDownInputState   state = new TestAbsPointerDownInputState(arg);

        state.AddVelocityToStack_Test(new Vector2(10f, 10f), 0);
        state.AddVelocityToStack_Test(new Vector2(10f, 10f), 1);
        state.AddVelocityToStack_Test(new Vector2(10f, 10f), 2);

        state.OnEnter();
        Assert.That(state.GetVelocityStack_Test(), Is.EqualTo(new Vector2[arg.velocityStackSize]));
    }
    public void OnPointerDown_ThrowsException()
    {
        IPointerDownInputStateConstArg arg   = CreateMockArg();
        TestAbsPointerDownInputState   state = new TestAbsPointerDownInputState(arg);

        Assert.Throws(
            Is.TypeOf(typeof(System.InvalidOperationException)).
            And.Message.EqualTo("OnPointerDown should not be called while pointer is already held down"),
            () => {
            state.OnPointerDown(Substitute.For <ICustomEventData>());
        }
            );
    }
    public void VelocityIsOverSwipeThreshold_VelocityNotLessThanThreshold_ReturnsTrue(
        Vector2 velocity,
        float threshold,
        bool expected
        )
    {
        IPointerDownInputStateConstArg arg = CreateMockArg();

        arg.engine.GetSwipeVelocityThreshold().Returns(threshold);
        TestAbsPointerDownInputState state = new TestAbsPointerDownInputState(arg);

        bool actual = state.VelocityIsOverSwipeThreshold_Test(velocity);

        Assert.That(actual, Is.EqualTo(expected));
    }