From 2bbc24d4d7d1ffcf6902550f50ebac7973a6f7a7 Mon Sep 17 00:00:00 2001 From: Timothy Makkison Date: Sun, 9 Jul 2023 10:16:12 +0100 Subject: [PATCH] fix: add private does not obscure test --- .../Mapping/ObjectPropertyTest.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyTest.cs b/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyTest.cs index 7614aaae32..fbc7c3c235 100644 --- a/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyTest.cs +++ b/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyTest.cs @@ -332,6 +332,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() {