@@ -36,12 +36,6 @@ public override TestEntity Build(TestDto dto)
3636 Value = dto . Value
3737 } ;
3838 }
39-
40- public override void Apply ( TestDto dto , TestEntity entityToUpdate )
41- {
42- entityToUpdate . Name = dto . Name ;
43- entityToUpdate . Value = dto . Value ;
44- }
4539 }
4640
4741 private class TestMapperWithRefinement : Mapper < TestEntity , TestDto >
@@ -64,12 +58,6 @@ public override TestEntity Build(TestDto dto)
6458 } ;
6559 }
6660
67- public override void Apply ( TestDto dto , TestEntity entityToUpdate )
68- {
69- entityToUpdate . Name = dto . Name ;
70- entityToUpdate . Value = dto . Value ;
71- }
72-
7361 public override TestEntity BuildRefiner ( TestEntity entity , TestDto dto )
7462 {
7563 entity . Name = entity . Name . ToUpper ( ) ;
@@ -81,11 +69,6 @@ public override TestDto ProjectAsRefiner(TestDto dto, TestEntity entity)
8169 dto . Name = dto . Name . ToLower ( ) ;
8270 return dto ;
8371 }
84-
85- public override void ApplyToRefiner ( TestEntity entity , TestDto dto )
86- {
87- entity . Name = entity . Name . Trim ( ) ;
88- }
8972 }
9073
9174 [ Fact ]
@@ -132,22 +115,6 @@ public void ProjectAsRefiner_DefaultImplementation_ReturnsDtoUnchanged()
132115 result . Value . Should ( ) . Be ( 100 ) ; // Unchanged
133116 }
134117
135- [ Fact ]
136- public void ApplyToRefiner_DefaultImplementation_DoesNothing ( )
137- {
138- // Arrange
139- var mapper = new TestMapper ( ) ;
140- var entity = new TestEntity { Name = "Test" , Value = 42 } ;
141- var dto = new TestDto { Name = "Different" , Value = 100 } ;
142-
143- // Act
144- mapper . ApplyToRefiner ( entity , dto ) ;
145-
146- // Assert
147- entity . Name . Should ( ) . Be ( "Test" ) ; // Unchanged
148- entity . Value . Should ( ) . Be ( 42 ) ; // Unchanged
149- }
150-
151118 [ Fact ]
152119 public void BuildRefiner_CustomImplementation_ModifiesEntity ( )
153120 {
@@ -181,22 +148,6 @@ public void ProjectAsRefiner_CustomImplementation_ModifiesDto()
181148 result . Name . Should ( ) . Be ( "different" ) ; // Modified to lowercase
182149 result . Value . Should ( ) . Be ( 100 ) ;
183150 }
184-
185- [ Fact ]
186- public void ApplyToRefiner_CustomImplementation_ModifiesEntity ( )
187- {
188- // Arrange
189- var mapper = new TestMapperWithRefinement ( ) ;
190- var entity = new TestEntity { Name = " test " , Value = 42 } ;
191- var dto = new TestDto { Name = "Different" , Value = 100 } ;
192-
193- // Act
194- mapper . ApplyToRefiner ( entity , dto ) ;
195-
196- // Assert
197- entity . Name . Should ( ) . Be ( "test" ) ; // Trimmed
198- entity . Value . Should ( ) . Be ( 42 ) ;
199- }
200151}
201152
202153public class MapperExtensionsTests
@@ -232,28 +183,6 @@ public override TestEntity Build(TestDto dto)
232183 Value = dto . Value
233184 } ;
234185 }
235-
236- public override void Apply ( TestDto dto , TestEntity entityToUpdate )
237- {
238- entityToUpdate . Name = dto . Name ;
239- entityToUpdate . Value = dto . Value ;
240- }
241- }
242-
243- [ Fact ]
244- public void Apply_Extension_UpdatesEntityAndReturnsIt ( )
245- {
246- // Arrange
247- var dto = new TestDto { Name = "Updated" , Value = 100 } ;
248- var entity = new TestEntity { Name = "Original" , Value = 50 } ;
249-
250- // Act
251- var result = dto . Apply < TestDto , TestEntity , TestMapper > ( entity ) ;
252-
253- // Assert
254- result . Should ( ) . BeSameAs ( entity ) ;
255- result . Name . Should ( ) . Be ( "Updated" ) ;
256- result . Value . Should ( ) . Be ( 100 ) ;
257186 }
258187
259188 [ Fact ]
@@ -288,26 +217,6 @@ public void Build_Extension_CreatesAndReturnsEntity()
288217 result . Value . Should ( ) . Be ( 42 ) ;
289218 }
290219
291- [ Fact ]
292- public void Apply_Extension_CreatesNewMapperInstance ( )
293- {
294- // Arrange
295- var dto = new TestDto { Name = "Test" , Value = 42 } ;
296- var entity1 = new TestEntity { Name = "Original1" , Value = 1 } ;
297- var entity2 = new TestEntity { Name = "Original2" , Value = 2 } ;
298-
299- // Act
300- var result1 = dto . Apply < TestDto , TestEntity , TestMapper > ( entity1 ) ;
301- var result2 = dto . Apply < TestDto , TestEntity , TestMapper > ( entity2 ) ;
302-
303- // Assert
304- // Both operations should work independently
305- result1 . Name . Should ( ) . Be ( "Test" ) ;
306- result1 . Value . Should ( ) . Be ( 42 ) ;
307- result2 . Name . Should ( ) . Be ( "Test" ) ;
308- result2 . Value . Should ( ) . Be ( 42 ) ;
309- }
310-
311220 [ Fact ]
312221 public void Project_Extension_CreatesNewMapperInstance ( )
313222 {
0 commit comments