Пример #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);
        }
Пример #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);
        }
Пример #3
0
        public void RemainingDurationShouldBeCalculatedCorrectly()
        {
            var tween = new TestTween(TimeSpan.FromTicks(100));

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

            Assert.Equal(50, tween.RemainingDuration.Ticks);
        }
Пример #4
0
        public void ProtectedHandleUpdateIsCalledOnUpdate()
        {
            var tween = new TestTween(new TimeSpan(100));

            tween.Advance(new TimeSpan(1));

            Assert.True(tween.WasAdvanceCalled);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }