Beispiel #1
0
        public void TestCompound()
        {
            var data3 = new Data3
            {
                data1 = new Data1 {
                    i = 890
                },
                f     = -2689789f,
                data2 = new Data2
                {
                    f = 7892f,
                    i = -25742,
                    s = "øøøøøøøøøøøø"
                }
            };
            var dataProp = containerSO.FindProperty(nameof(DataContainer.data3));

            SerializedPropertyHelper.SetValue(dataProp, data3);

            Assert.AreEqual(data3.data1.i, container.data3.data1.i);
            Assert.AreEqual(data3.f, container.data3.f);
            Assert.AreEqual(data3.data2.f, container.data3.data2.f);
            Assert.AreEqual(data3.data2.i, container.data3.data2.i);
            Assert.AreEqual(data3.data2.s, container.data3.data2.s);
        }
Beispiel #2
0
        public void TestJustAnInt()
        {
            var justAnIntProp = containerSO.FindProperty(nameof(DataContainer.justAnInt));

            SerializedPropertyHelper.SetValue(justAnIntProp, 13);

            Assert.AreEqual(13, container.justAnInt);
        }
Beispiel #3
0
        public void TestSetData1Value()
        {
            var data = new Data1 {
                i = 15
            };
            var dataProp = containerSO.FindProperty(nameof(DataContainer.data1));

            SerializedPropertyHelper.SetValue(dataProp, data);

            Assert.AreEqual(15, container.data1.i);
        }
Beispiel #4
0
        public void TestSetData2Value()
        {
            var data2 = new Data2
            {
                i = 2345,
                s = "1dkløasgjp+",
                f = 58582f
            };
            var dataProp = containerSO.FindProperty(nameof(DataContainer.data2));

            SerializedPropertyHelper.SetValue(dataProp, data2);

            Assert.AreEqual(data2.i, container.data2.i);
            Assert.AreEqual(data2.s, container.data2.s);
            Assert.AreEqual(data2.f, container.data2.f);
        }