@@ -41,7 +41,7 @@ public void AdaptRecordStructToRecordStruct()
4141 var _structResult = _sourceStruct . Adapt ( _destinationStruct ) ;
4242
4343 _structResult . X . ShouldBe ( 1000 ) ;
44- _structResult . X . ShouldNotBe ( _destinationStruct . X ) ;
44+ _destinationStruct . X . Equals ( _structResult . X ) . ShouldBeFalse ( ) ;
4545 }
4646
4747 [ TestMethod ]
@@ -227,6 +227,56 @@ public void DetectFakeRecord()
227227 _destination . X . ShouldBe ( 200 ) ;
228228 object . ReferenceEquals ( _destination , _result ) . ShouldBeTrue ( ) ;
229229 }
230+
231+ [ TestMethod ]
232+ public void OnlyInlineRecordWorked ( )
233+ {
234+ var _sourcePoco = new InlinePoco501 ( ) { MyInt = 1 , MyString = "Hello" } ;
235+ var _sourceOnlyInitRecord = new OnlyInitRecord501 { MyInt = 2 , MyString = "Hello World" } ;
236+
237+ var _resultOnlyinitRecord = _sourcePoco . Adapt < OnlyInitRecord501 > ( ) ;
238+ var _updateResult = _sourceOnlyInitRecord . Adapt ( _resultOnlyinitRecord ) ;
239+
240+ _resultOnlyinitRecord . MyInt . ShouldBe ( 1 ) ;
241+ _resultOnlyinitRecord . MyString . ShouldBe ( "Hello" ) ;
242+ _updateResult . MyInt . ShouldBe ( 2 ) ;
243+ _updateResult . MyString . ShouldBe ( "Hello World" ) ;
244+ }
245+
246+ [ TestMethod ]
247+ public void MultyCtorRecordWorked ( )
248+ {
249+ var _sourcePoco = new InlinePoco501 ( ) { MyInt = 1 , MyString = "Hello" } ;
250+ var _sourceMultyCtorRecord = new MultiCtorRecord ( 2 , "Hello World" ) ;
251+
252+ var _resultMultyCtorRecord = _sourcePoco . Adapt < MultiCtorRecord > ( ) ;
253+ var _updateResult = _sourceMultyCtorRecord . Adapt ( _resultMultyCtorRecord ) ;
254+
255+ _resultMultyCtorRecord . MyInt . ShouldBe ( 1 ) ;
256+ _resultMultyCtorRecord . MyString . ShouldBe ( "Hello" ) ;
257+ _updateResult . MyInt . ShouldBe ( 2 ) ;
258+ _updateResult . MyString . ShouldBe ( "Hello World" ) ;
259+ }
260+
261+ [ TestMethod ]
262+ public void MultiCtorAndInlineRecordWorked ( )
263+ {
264+ var _sourcePoco = new MultiCtorAndInlinePoco ( ) { MyInt = 1 , MyString = "Hello" , MyEmail = "[email protected] " , InitData = "Test" } ; 265+ var _sourceMultiCtorAndInline = new MultiCtorAndInlineRecord ( 2 , "Hello World" ) { InitData = "Worked" , MyEmail = "[email protected] " } ; 266+
267+ var _resultMultiCtorAndInline = _sourcePoco . Adapt < MultiCtorAndInlineRecord > ( ) ;
268+ var _updateResult = _sourceMultiCtorAndInline . Adapt ( _resultMultiCtorAndInline ) ;
269+
270+ _resultMultiCtorAndInline . MyInt . ShouldBe ( 1 ) ;
271+ _resultMultiCtorAndInline . MyString . ShouldBe ( "Hello" ) ;
272+ _resultMultiCtorAndInline . MyEmail . ShouldBe ( "[email protected] " ) ; 273+ _resultMultiCtorAndInline . InitData . ShouldBe ( "Test" ) ;
274+ _updateResult . MyInt . ShouldBe ( 2 ) ;
275+ _updateResult . MyString . ShouldBe ( "Hello World" ) ;
276+ _updateResult . MyEmail . ShouldBe ( "[email protected] " ) ; 277+ _updateResult . InitData . ShouldBe ( "Worked" ) ;
278+ }
279+
230280
231281 #region NowNotWorking
232282
@@ -255,6 +305,61 @@ public void CollectionUpdate()
255305
256306 #region TestClasses
257307
308+ class MultiCtorAndInlinePoco
309+ {
310+ public int MyInt { get ; set ; }
311+ public string MyString { get ; set ; }
312+ public string MyEmail { get ; set ; }
313+ public string InitData { get ; set ; }
314+ }
315+
316+ record MultiCtorAndInlineRecord
317+ {
318+ public MultiCtorAndInlineRecord ( int myInt )
319+ {
320+ MyInt = myInt ;
321+ }
322+
323+ public MultiCtorAndInlineRecord ( int myInt , string myString ) : this ( myInt )
324+ {
325+ MyString = myString ;
326+ }
327+
328+
329+ public int MyInt { get ; private set ; }
330+ public string MyString { get ; private set ; }
331+ public string MyEmail { get ; set ; }
332+ public string InitData { get ; init ; }
333+ }
334+
335+ record MultiCtorRecord
336+ {
337+ public MultiCtorRecord ( int myInt )
338+ {
339+ MyInt = myInt ;
340+ }
341+
342+ public MultiCtorRecord ( int myInt , string myString ) : this ( myInt )
343+ {
344+ MyString = myString ;
345+ }
346+
347+ public int MyInt { get ; private set ; }
348+ public string MyString { get ; private set ; }
349+ }
350+
351+ class InlinePoco501
352+ {
353+ public int MyInt { get ; set ; }
354+ public string MyString { get ; set ; }
355+ }
356+
357+ record OnlyInitRecord501
358+ {
359+ public int MyInt { get ; init ; }
360+ public string MyString { get ; init ; }
361+ }
362+
258363 class PocoWithGuid
259364 {
260365 public Guid Id { get ; init ; }
0 commit comments