Esempio n. 1
0
    public void Calculate_DeltaPosZero_ReturnsFalse()
    {
        IScroller scroller = Substitute.For <IScroller>();

        scroller.GetElementCursorOffsetInPixel(Arg.Any <float>(), Arg.Any <int>()).Returns(0f);
        ElementIsScrolledToIncreaseCursorOffsetCalculator calculator = new ElementIsScrolledToIncreaseCursorOffsetCalculator(scroller);
        float anyLocalPosOnAxis = 222222222f;

        for (int i = 0; i < 2; i++)
        {
            bool actual = calculator.Calculate(0f, anyLocalPosOnAxis, i);
            Assert.That(actual, Is.False);
        }
    }
Esempio n. 2
0
    public void Calculate_DeltaPosNonZero_ElementCursorOfffsetPixelIsNotZero_Various(float cursorOffsetInPixel, float deltaPosOnAxis, bool expected)
    {
        IScroller scroller = Substitute.For <IScroller>();

        scroller.GetElementCursorOffsetInPixel(Arg.Any <float>(), Arg.Any <int>()).Returns(cursorOffsetInPixel);
        ElementIsScrolledToIncreaseCursorOffsetCalculator calculator = new ElementIsScrolledToIncreaseCursorOffsetCalculator(scroller);
        float anyLocalPosOnAxis = -1111111f;

        for (int i = 0; i < 2; i++)
        {
            bool actual = calculator.Calculate(deltaPosOnAxis, anyLocalPosOnAxis, i);

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