Beispiel #1
0
        public void TestInterfaceProperty()
        {
            var test = new TestClass();

            var updateMemberInfo = new List <UpdateMemberInfo>
            {
                new UpdateMemberInfo("TestInterface.InterfaceMember", 0),
            };

            var blittableData = new TestData[] { 123 };
            var objectData    = new UpdateObjectData[0];

            RunUpdateEngine(test, updateMemberInfo, blittableData, objectData);

            Assert.Equal(123, test.TestInterface.InterfaceMember);
        }
Beispiel #2
0
        public void TestIntProperty()
        {
            var test = new TestClass();

            var updateMemberInfo = new List <UpdateMemberInfo>
            {
                new UpdateMemberInfo("IntProperty", 0),
            };

            var blittableData = new TestData[] { 123 };
            var objectData    = new UpdateObjectData[0];

            RunUpdateEngine(test, updateMemberInfo, blittableData, objectData);

            Assert.That(test.IntProperty, Is.EqualTo(123));
        }
Beispiel #3
0
        public void TestIntList()
        {
            var test = new TestClass();

            var updateMemberInfo = new List <UpdateMemberInfo>
            {
                new UpdateMemberInfo("IntList[0]", 0),
                new UpdateMemberInfo("IntList[2]", 0),
                new UpdateMemberInfo("IntList[3]", 8),
            };

            var blittableData = new TestData[] { 123, 456 };
            var objectData    = new UpdateObjectData[0];

            RunUpdateEngine(test, updateMemberInfo, blittableData, objectData);

            Assert.Equal(123, test.IntList[0]);
            Assert.Equal(0, test.IntList[1]);
            Assert.Equal(123, test.IntList[2]);
            Assert.Equal(456, test.IntList[3]);
        }
Beispiel #4
0
        public void TestIntArray()
        {
            var test = new TestClass();

            var updateMemberInfo = new List <UpdateMemberInfo>
            {
                new UpdateMemberInfo("IntArray[0]", 0),
                new UpdateMemberInfo("IntArray[2]", 0),
                new UpdateMemberInfo("IntArray[3]", 8),
            };

            var blittableData = new TestData[] { 123, 456 };
            var objectData    = new UpdateObjectData[0];

            RunUpdateEngine(test, updateMemberInfo, blittableData, objectData);

            Assert.That(test.IntArray[0], Is.EqualTo(123));
            Assert.That(test.IntArray[1], Is.EqualTo(0));
            Assert.That(test.IntArray[2], Is.EqualTo(123));
            Assert.That(test.IntArray[3], Is.EqualTo(456));
        }
Beispiel #5
0
        public void TestCastQualifiedName()
        {
            var test = new TestClass()
            {
                ObjectField    = new TestClass(),
                ObjectProperty = new TestClass(),
            };

            var updateMemberInfo = new List <UpdateMemberInfo>
            {
                new UpdateMemberInfo("ObjectField.(Stride.Engine.Tests.TestClass,Stride.Engine.Tests).IntField", 0),
                new UpdateMemberInfo("ObjectProperty.(Stride.Engine.Tests.TestClass,Stride.Engine.Tests).IntField", 8),
            };

            var blittableData = new TestData[] { 123, 456 };
            var objectData    = new UpdateObjectData[0];

            RunUpdateEngine(test, updateMemberInfo, blittableData, objectData);

            Assert.Equal(123, ((TestClass)test.ObjectField).IntField);
            Assert.Equal(456, ((TestClass)test.ObjectProperty).IntField);
        }
Beispiel #6
0
        public void TestAbstractProperty()
        {
            var test = new TestClass();

            var updateMemberInfo = new List <UpdateMemberInfo>
            {
                new UpdateMemberInfo("IntPropertyAbstract", 0),
            };

            var blittableData = new TestData[] { 123 };
            var objectData    = new UpdateObjectData[0];

            RunUpdateEngine(test, updateMemberInfo, blittableData, objectData);

            Assert.Equal(123, test.IntPropertyAbstract);

            // Test again with using TestClassBase type
            test.IntPropertyAbstract = 0;
            RunUpdateEngine(test, updateMemberInfo, blittableData, objectData, typeof(TestClassBase));

            Assert.Equal(123, test.IntPropertyAbstract);
        }
Beispiel #7
0
        public void TestBlittableStruct()
        {
            var test = new TestClass();

            var updateMemberInfo = new List <UpdateMemberInfo>
            {
                new UpdateMemberInfo("BlittableStructField.IntField", 0),
                new UpdateMemberInfo("BlittableStructField.IntProperty", 8),
                new UpdateMemberInfo("BlittableStructProperty.IntField", 0),
                new UpdateMemberInfo("BlittableStructProperty.IntProperty", 8),
            };

            var blittableData = new TestData[] { 123, 456 };
            var objectData    = new UpdateObjectData[0];

            RunUpdateEngine(test, updateMemberInfo, blittableData, objectData);

            Assert.Equal(123, test.BlittableStructField.IntField);
            Assert.Equal(456, test.BlittableStructField.IntProperty);
            Assert.Equal(123, test.BlittableStructProperty.IntField);
            Assert.Equal(456, test.BlittableStructProperty.IntProperty);
        }
Beispiel #8
0
        public void TestCastQualifiedName()
        {
            var test = new TestClass()
            {
                ObjectField    = new TestClass(),
                ObjectProperty = new TestClass(),
            };

            var updateMemberInfo = new List <UpdateMemberInfo>
            {
                new UpdateMemberInfo("ObjectField.(SiliconStudio.Xenko.Engine.Tests.TestClass,SiliconStudio.Xenko.Engine.Tests).IntField", 0),
                new UpdateMemberInfo("ObjectProperty.(SiliconStudio.Xenko.Engine.Tests.TestClass,SiliconStudio.Xenko.Engine.Tests).IntField", 8),
            };

            var blittableData = new TestData[] { 123, 456 };
            var objectData    = new UpdateObjectData[0];

            RunUpdateEngine(test, updateMemberInfo, blittableData, objectData);

            Assert.That(((TestClass)test.ObjectField).IntField, Is.EqualTo(123));
            Assert.That(((TestClass)test.ObjectProperty).IntField, Is.EqualTo(456));
        }