Esempio n. 1
0
        public void ShouldReturnUsedTime_moreThanDuration()
        {
            var tween  = new TestTween(new TimeSpan(100));
            var result = tween.Advance(new TimeSpan(150));

            Assert.Equal(100, result.Ticks);
        }
Esempio n. 2
0
        public void DurationShouldBeSetCorrectly(int duration)
        {
            var tween = new TestTween(TimeSpan.FromTicks(duration));

            Assert.Equal(duration, tween.Duration.Ticks);
            Assert.Equal(duration, tween.RemainingDuration.Ticks);
        }
Esempio n. 3
0
        public void RemainingDurationShouldBeCalculatedCorrectly()
        {
            var tween = new TestTween(TimeSpan.FromTicks(100));

            tween.Advance(TimeSpan.FromTicks(50));

            Assert.Equal(50, tween.RemainingDuration.Ticks);
        }
Esempio n. 4
0
        public void ProtectedHandleUpdateIsCalledOnUpdate()
        {
            var tween = new TestTween(new TimeSpan(100));

            tween.Advance(new TimeSpan(1));

            Assert.True(tween.WasAdvanceCalled);
        }
Esempio n. 5
0
        public void FinishedCallbackIsTriggeredWhenTweenFinishes()
        {
            var wasFinishCalled = false;
            var tween           = new TestTween(new TimeSpan(100), () => wasFinishCalled = true);

            tween.Advance(new TimeSpan(100));

            Assert.True(wasFinishCalled);
        }
Esempio n. 6
0
        public void ShouldReturnZeroTimeWhenTweenIsAlreadyFinished()
        {
            var tween = new TestTween(new TimeSpan(100));

            tween.Finish();
            var result = tween.Advance(new TimeSpan(100));

            Assert.Equal(0, result.Ticks);
        }
Esempio n. 7
0
        public void FinishShouldInvokeUpdateAndFinishCallback()
        {
            var wasFinishCalled = false;
            var tween           = new TestTween(new TimeSpan(100), () => wasFinishCalled = true);

            tween.Finish();

            Assert.True(wasFinishCalled);
            Assert.True(tween.WasAdvanceCalled);
        }