diff --git a/protobuf-net.unittest/Aqla/ReferenceVersioningWithSkip.cs b/protobuf-net.unittest/Aqla/ReferenceVersioningWithSkip.cs new file mode 100644 index 00000000..468412b2 --- /dev/null +++ b/protobuf-net.unittest/Aqla/ReferenceVersioningWithSkip.cs @@ -0,0 +1,89 @@ +using AqlaSerializer.Meta; +using NUnit.Framework; + +namespace AqlaSerializer.unittest.Aqla +{ + [TestFixture] + public class ReferenceVersioningWithSkip + { + [SerializableType] + public class SimpleFoo + { + } + + [SerializableType] + public class SourceSimple + { + [SerializableMember(1)] + public SimpleFoo Foo { get; set; } + + [SerializableMember(2)] + public SimpleFoo SameFoo { get; set; } + } + + [SerializableType] + public class DestinationSimple + { + [SerializableMember(2)] + public SimpleFoo SameFoo { get; set; } + } + + [Test] + public void ChangeSimple() + { + var tm = TypeModel.Create(); + var obj = new SourceSimple(); + obj.Foo = obj.SameFoo = new SimpleFoo(); + var changed = tm.ChangeType(obj); + Assert.That(changed.SameFoo, Is.Not.Null); + } + + [Test] + public void ChangeComplex() + { + var tm = TypeModel.Create(); + var obj = new SourceComplex(); + obj.Bar = obj.SameBar = new SourceBar(); + obj.Bar.Foo = obj.SameFoo = new SimpleFoo(); + var changed = tm.ChangeType(obj); + Assert.That(changed.SameBar, Is.Not.Null); + Assert.That(changed.SameFoo, Is.Not.Null); + } + + // recursive: removed property inside removed property + [SerializableType] + public class SourceBar + { + [SerializableMember(1)] + public SimpleFoo Foo { get; set; } + } + + [SerializableType] + public class DestionationBar + { + } + + [SerializableType] + public class SourceComplex + { + [SerializableMember(1)] + public SourceBar Bar { get; set; } + + [SerializableMember(2)] + public SourceBar SameBar { get; set; } + + [SerializableMember(3)] + public SimpleFoo SameFoo { get; set; } + } + + [SerializableType] + public class DestinationComplex + { + [SerializableMember(2)] + public DestionationBar SameBar { get; set; } + + [SerializableMember(3)] + public SimpleFoo SameFoo { get; set; } + } + } +} \ No newline at end of file diff --git a/protobuf-net.unittest/aqlaserializer.unittest.csproj b/protobuf-net.unittest/aqlaserializer.unittest.csproj index 2c5c0f65..8549b22c 100644 --- a/protobuf-net.unittest/aqlaserializer.unittest.csproj +++ b/protobuf-net.unittest/aqlaserializer.unittest.csproj @@ -153,6 +153,7 @@ +