diff --git a/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyTest.cs b/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyTest.cs index fd0f220293..774252f3cb 100644 --- a/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyTest.cs +++ b/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyTest.cs @@ -329,6 +329,29 @@ public Task WithPrivateTargetPathGetterShouldIgnoreAndDiagnostic() return TestHelper.VerifyGenerator(source); } + [Fact] + public void PrivateMemberPropertyShouldNotOverride() + { + var source = TestSourceBuilder.Mapping( + "A", + "B", + "class A { private int MyValue { get; set; } public C My { get; set; } }", + "class B { public int MyValue { get; set; } }", + "class C { public int Value { get; set; } }" + ); + + TestHelper + .GenerateMapper(source) + .Should() + .HaveMapMethodBody( + """ + var target = new global::B(); + target.MyValue = source.My.Value; + return target; + """ + ); + } + [Fact] public Task WithPrivateSourceGetterShouldIgnoreAndDiagnostic() {