예제 #1
0
        public void CreateTweenerWithAccessorTest()
        {
            var obj = new TweeningTestObject();
            var registeredPropertyTweens = new Dictionary <string, Type>();

            // register tweener for ints
            registeredPropertyTweens.Add(typeof(SByte).FullName, typeof(SignedByteTweener));
            registeredPropertyTweens.Add(typeof(Int16).FullName, typeof(SignedInt16Tweener));
            registeredPropertyTweens.Add(typeof(Int32).FullName, typeof(SignedInt32Tweener));
            registeredPropertyTweens.Add(typeof(Int64).FullName, typeof(SignedInt64Tweener));
            // register tweener for unsigned ints
            registeredPropertyTweens.Add(typeof(Byte).FullName, typeof(UnsignedByteTweener));
            registeredPropertyTweens.Add(typeof(UInt16).FullName, typeof(UnsignedInt16Tweener));
            registeredPropertyTweens.Add(typeof(UInt32).FullName, typeof(UnsignedInt32Tweener));
            registeredPropertyTweens.Add(typeof(UInt64).FullName, typeof(UnsignedInt64Tweener));
            // register tweener for floats
            registeredPropertyTweens.Add(typeof(Single).FullName, typeof(FloatTweener));
            // register tweener for doubles
            registeredPropertyTweens.Add(typeof(Double).FullName, typeof(DoubleTweener));


            var param0 = new PrivateObject(new TweenedObject(new TweeningTestObject(), registeredPropertyTweens));
            var target = new TweenedObject_Accessor(param0);

            ITweenSharkTweener tweener = target.CreateTweener(new PropertyOps("SbyteValue", 100, false));

            Assert.IsInstanceOfType(tweener, typeof(SignedByteTweener));

            tweener = target.CreateTweener(new PropertyOps("ShortValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(SignedInt16Tweener));

            tweener = target.CreateTweener(new PropertyOps("IntValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(SignedInt32Tweener));

            tweener = target.CreateTweener(new PropertyOps("LongValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(SignedInt64Tweener));

            tweener = target.CreateTweener(new PropertyOps("ByteValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(UnsignedByteTweener));

            tweener = target.CreateTweener(new PropertyOps("UshortValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(UnsignedInt16Tweener));

            tweener = target.CreateTweener(new PropertyOps("UintValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(UnsignedInt32Tweener));

            tweener = target.CreateTweener(new PropertyOps("UlongValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(UnsignedInt64Tweener));

            tweener = target.CreateTweener(new PropertyOps("DoubleValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(DoubleTweener));

            tweener = target.CreateTweener(new PropertyOps("FloatValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(FloatTweener));
        }
예제 #2
0
        public void CreateTweenerTest()
        {
            var obj = new TweeningTestObject();
            var registeredPropertyTweens = new Dictionary <string, Type>();

            registeredPropertyTweens.Add(typeof(SByte).FullName, typeof(SignedByteTweener));

            var param0 = new PrivateObject(new TweenedObject(new TweeningTestObject(), registeredPropertyTweens));
            var target = new TweenedObject_Accessor(param0);

            // when we give a tweener we must get one returned
            ITweenSharkTweener tweener = target.CreateTweener(new PropertyOps("SbyteValue", 100, new GenericTweenerImpl <SByte>(), false));

            Assert.IsInstanceOfType(tweener, typeof(GenericTweenerImpl <SByte>));

            // when we dont give a tweener CreateTweener will try to create it
            tweener = target.CreateTweener(new PropertyOps("SbyteValue", 100, false));
            Assert.IsInstanceOfType(tweener, typeof(SignedByteTweener));
        }