@@ -172,43 +172,6 @@ public void IgnoreIf_Apply_To_RecordType()
172172 dto . Name . ShouldBeNull ( ) ;
173173 }
174174
175- // Regression test for https://github.com/MapsterMapper/Mapster/issues/1007
176- // Unlike SimpleRecord above (which maps every member through the primary
177- // constructor), NativeRecord is a real C# `record` whose Name property is
178- // NOT part of the primary constructor — it's a plain settable auto-property.
179- // Members mapped that way go through RecordTypeAdapter.RecordInlineExpression,
180- // a separate code path from constructor-argument mapping, which used to
181- // ignore member.Ignore.Condition entirely.
182- [ TestMethod ]
183- public void IgnoreIf_Apply_To_RecordType_Property_Not_In_Constructor_Map ( )
184- {
185- TypeAdapterConfig < SimplePoco , NativeRecord > . NewConfig ( )
186- . IgnoreIf ( ( src , dest ) => src . Name == "TestName" , dest => dest . Name )
187- . Compile ( ) ;
188-
189- var poco = new SimplePoco { Id = 1 , Name = "TestName" } ;
190- var dto = TypeAdapter . Adapt < SimplePoco , NativeRecord > ( poco ) ;
191-
192- dto . Id . ShouldBe ( 1 ) ;
193- dto . Name . ShouldBeNull ( ) ;
194- }
195-
196- [ TestMethod ]
197- public void IgnoreIf_Apply_To_RecordType_Property_Not_In_Constructor_MapToTarget ( )
198- {
199- TypeAdapterConfig < SimplePoco , NativeRecord > . NewConfig ( )
200- . IgnoreIf ( ( src , dest ) => src . Name == "TestName" , dest => dest . Name )
201- . Compile ( ) ;
202-
203- var poco = new SimplePoco { Id = 1 , Name = "TestName" } ;
204- var dto = new NativeRecord { Id = 999 , Name = "DtoName" } ;
205-
206- var result = TypeAdapter . Adapt ( poco , dto ) ;
207-
208- result . Id . ShouldBe ( 1 ) ;
209- result . Name . ShouldBe ( "DtoName" ) ;
210- }
211-
212175 #endregion
213176
214177
@@ -239,12 +202,6 @@ public SimpleRecord(int id, string name)
239202 }
240203 }
241204
242- public record NativeRecord
243- {
244- public int Id { get ; set ; }
245- public string Name { get ; set ; }
246- }
247-
248205 #endregion
249206
250207 }
0 commit comments