コード例 #1
0
        public void TryPack_FlatStructure()
        {
            var config = Configurable.CreateConfig("TryPack_FlatStructure", "ObjectMarshaller_IntegrationalTests").Clear();
            var proxy  = new ConfigAccessorProxy(config, "Object1");

            var m = new FlatStructObjectMarshaller();

            Assert.True(m.TryPack(proxy, new V2(1, 2)));

            var actual   = config.ToString();
            var expected = @"[Object1]
X=1
Y=2
";

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void TryPack_FlatStructureWithPrivateFields()
        {
            var config = (ConfigAccessor)Configurable.CreateConfig("TryPack_FlatStructureWithPrivateFields", "ObjectMarshaller_IntegrationalTests").Clear();
            var proxy  = new ConfigAccessorProxy(config, "Object1");

            var m = new FlatStructObjectMarshaller();

            Assert.True(m.TryPack(proxy, new FlatStructWithPrivateFields(1, 2, 3, 4)));

            var actual   = config.ToString();
            var expected = @"[Object1]
X1=1
X2=2
X3=3
X4=4
";

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void TryPack_ThreeLevelNotFlatStruct()
        {
            var config = (ConfigAccessor)Configurable.CreateConfig("TryPack_ThreeLevelNotFlatStruct", "ObjectMarshaller_IntegrationalTests").Clear();
            var proxy  = new ConfigAccessorProxy(config, "Object1");

            var m = new FlatStructObjectMarshaller();

            Assert.True(m.TryPack(proxy, new ThreeLevelNotFlatStruct(new MixedFlatnessStruct(1, new V2(2, 3)), 4)));

            var actual   = config.ToString();
            var expected = @"[Object1]
SomeValue=4
[Object1.Struct]
X1=1
[Object1.Struct.V1]
X=2
Y=3
";

            Assert.AreEqual(expected, actual);
        }