상속: ITimeProvider
예제 #1
0
        public void TestScalableTimeProvider()
        {
            var realTime = new MockTimeProvider();
            var scalable = new ScalableTimeProvider(realTime);

            Assert.AreEqual(realTime.Ticks, scalable.Ticks);

            scalable.TimeScale = 0.5f;
            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);

            scalable.TimeScale = 1.0f;
            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);

            scalable.TimeScale = 2.0f;
            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks + 50, scalable.Ticks);

            scalable.TimeScale = 0.0f;
            Assert.AreEqual(realTime.Ticks + 50, scalable.Ticks);

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);

            scalable.TimeScale = 1.0f;
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);
        }
예제 #2
0
파일: TimeTests.cs 프로젝트: sq/Fracture
        public void TestScalableTimeProvider()
        {
            var realTime = new MockTimeProvider();
            var scalable = new ScalableTimeProvider(realTime);

            Assert.AreEqual(realTime.Ticks, scalable.Ticks);

            scalable.TimeScale = 0.5f;
            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);

            scalable.TimeScale = 1.0f;
            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);

            scalable.TimeScale = 2.0f;
            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks + 50, scalable.Ticks);

            scalable.TimeScale = 0.0f;
            Assert.AreEqual(realTime.Ticks + 50, scalable.Ticks);

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);

            scalable.TimeScale = 1.0f;
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 50, scalable.Ticks);
        }
예제 #3
0
        public void TestPausableTimeProvider()
        {
            var realTime = new MockTimeProvider();
            var pausable = new PausableTimeProvider(realTime);

            Assert.AreEqual(realTime.Ticks, pausable.Ticks);

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks, pausable.Ticks);

            pausable.Paused = true;

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 100, pausable.Ticks);

            pausable.Paused = false;
            Assert.AreEqual(realTime.Ticks - 100, pausable.Ticks);

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 100, pausable.Ticks);
        }
예제 #4
0
파일: TimeTests.cs 프로젝트: sq/Fracture
        public void TestPausableTimeProvider()
        {
            var realTime = new MockTimeProvider();
            var pausable = new PausableTimeProvider(realTime);

            Assert.AreEqual(realTime.Ticks, pausable.Ticks);

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks, pausable.Ticks);

            pausable.Paused = true;

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 100, pausable.Ticks);

            pausable.Paused = false;
            Assert.AreEqual(realTime.Ticks - 100, pausable.Ticks);

            realTime.Advance(100);
            Assert.AreEqual(realTime.Ticks - 100, pausable.Ticks);
        }