Exemplo n.º 1
0
        public void TranslationRangeTest()
        {
            TimeWarpCollection collection = new TimeWarpCollection();

            collection.Add(new TimeWarp()
            {
                From = new TimeSpan(0, 0, -5), To = new TimeSpan(0, 0, -5)
            });
            collection.Add(new TimeWarp()
            {
                From = new TimeSpan(0, 0, 10), To = new TimeSpan(0, 0, 10)
            });
            collection.Add(new TimeWarp()
            {
                From = new TimeSpan(0, 0, 20), To = new TimeSpan(0, 0, 20)
            });
            collection.Add(new TimeWarp()
            {
                From = new TimeSpan(0, 0, 40), To = new TimeSpan(0, 0, 40)
            });

            for (int x = -10; x <= 50; x++)
            {
                Assert.AreEqual(new TimeSpan(0, 0, x), collection.TranslateSourceToWarpedPosition(new TimeSpan(0, 0, x)));
            }
        }
Exemplo n.º 2
0
        public void TWC1()
        {
            TimeWarpCollection collection = new TimeWarpCollection();

            collection.Add(new TimeWarp()
            {
                From = new TimeSpan(0, 0, 5), To = new TimeSpan(0, 0, 0)
            });
            collection.Add(new TimeWarp()
            {
                From = new TimeSpan(0, 0, 15), To = new TimeSpan(0, 0, 15)
            });

            Assert.AreEqual(new TimeSpan(0, 0, -5), collection.TranslateSourceToWarpedPosition(new TimeSpan(0, 0, 0)));
            Assert.AreEqual(new TimeSpan(0, 0, 0), collection.TranslateSourceToWarpedPosition(new TimeSpan(0, 0, 5)));
            Assert.AreEqual(new TimeSpan(0, 0, 0, 7, 500), collection.TranslateSourceToWarpedPosition(new TimeSpan(0, 0, 10)));
            Assert.AreEqual(new TimeSpan(0, 0, 15), collection.TranslateSourceToWarpedPosition(new TimeSpan(0, 0, 15)));
            Assert.AreEqual(new TimeSpan(0, 0, 20), collection.TranslateSourceToWarpedPosition(new TimeSpan(0, 0, 20)));
        }