public async Task NewAnimationsFinishImmediatelyWhenTickerDisabled()
        {
            var view = AnimationReadyHandlerAsync.Prepare(new View(), out var handler);

            await handler.DisableTicker();

            await view.RotateYTo(200);

            Assert.That(view.RotationY, Is.EqualTo(200));
        }
        public async Task DisablingTickerPreventsAnimationFromRepeating()
        {
            var view = AnimationReadyHandlerAsync.Prepare(new View {
                Opacity = 0
            }, out var handler);

            await Task.WhenAll(RepeatFade(view), handler.DisableTicker());

            Assert.That(view.Opacity, Is.EqualTo(1));
        }
        public async Task DisablingTickerFinishesAnimationInProgress()
        {
            var view = AnimationReadyHandlerAsync.Prepare(new View {
                Opacity = 1
            }, out var handler);

            await Task.WhenAll(view.FadeTo(0, 2000), handler.DisableTicker());

            Assert.That(view.Opacity, Is.EqualTo(0));
        }
        public async Task AnimationExtensionsReturnTrueIfAnimationsDisabled()
        {
            var label = AnimationReadyHandlerAsync.Prepare(new Label {
                Text = "Foo"
            }, out var handler);

            await handler.DisableTicker();

            var result = await label.ScaleTo(2, 500);

            Assert.That(result, Is.True);
        }
        public async Task DisablingTickerFinishesAllAnimationsInChain()
        {
            var view1 = new View {
                Opacity = 1
            };
            var view2 = new View {
                Opacity = 0
            };

            var handler = AnimationReadyHandlerAsync.Prepare(view1, view2);

            await Task.WhenAll(SwapFadeViews(view1, view2), handler.DisableTicker());

            Assert.That(view1.Opacity, Is.EqualTo(0));
        }
        public async Task CanExitAnimationLoopIfAnimationsDisabled()
        {
            var label = AnimationReadyHandlerAsync.Prepare(new Label {
                Text = "Foo"
            }, out var handler);

            await handler.DisableTicker();

            var run = true;

            while (run)
            {
                await label.ScaleTo(2, 500);

                run = !(await label.ScaleTo(0.5, 500));
            }
        }