@@ -159,7 +159,7 @@ public async Task CanSyncRandomEntries(ApiType? roundTripApiType)
159159 . Select ( createdCfc =>
160160 {
161161 var copy = createdCfc . Copy ( ) ;
162- copy . ComponentHeadword = after . Headword ( ) ;
162+ copy . ComponentHeadword = after . HeadwordText ( ) ;
163163 return copy ;
164164 } ) ,
165165 // keep new
@@ -175,7 +175,7 @@ public async Task CanSyncRandomEntries(ApiType? roundTripApiType)
175175 . Select ( createdCfc =>
176176 {
177177 var copy = createdCfc . Copy ( ) ;
178- copy . ComplexFormHeadword = after . Headword ( ) ;
178+ copy . ComplexFormHeadword = after . HeadwordText ( ) ;
179179 return copy ;
180180 } ) ,
181181 // keep new
@@ -210,19 +210,18 @@ public async Task CanSyncRandomEntries(ApiType? roundTripApiType)
210210 {
211211 options = options
212212 . WithStrictOrdering ( )
213+ . Excluding ( e => e . Headword ) // Computed property, populated by Finalize
213214 . WithoutStrictOrderingFor ( e => e . ComplexForms ) // sorted alphabetically
214215 . WithoutStrictOrderingFor ( e => e . Path . EndsWith ( $ ".{ nameof ( Sense . SemanticDomains ) } ") ) // not sorted
215216 . For ( e => e . Senses ) . Exclude ( s => s . Order )
216217 . For ( e => e . Components ) . Exclude ( c => c . Order )
217218 . For ( e => e . ComplexForms ) . Exclude ( c => c . Order )
218219 . For ( e => e . Senses ) . For ( s => s . ExampleSentences ) . Exclude ( e => e . Order ) ;
219- if ( currentApiType == ApiType . Crdt )
220- {
221- // does not yet update Headwords 😕
222- options = options
223- . For ( e => e . Components ) . Exclude ( c => c . ComplexFormHeadword )
224- . For ( e => e . ComplexForms ) . Exclude ( c => c . ComponentHeadword ) ;
225- }
220+ // ComplexFormHeadword/ComponentHeadword are computed from HeadwordText() which
221+ // depends on the computed Headword property — exclude since AutoFaker randomizes it.
222+ options = options
223+ . For ( e => e . Components ) . Exclude ( c => c . ComplexFormHeadword )
224+ . For ( e => e . ComplexForms ) . Exclude ( c => c . ComponentHeadword ) ;
226225 if ( currentApiType == ApiType . FwData )
227226 {
228227 // does not support changing MorphType yet (see UpdateEntryProxy.MorphType)
@@ -280,15 +279,15 @@ public async Task CanChangeComplexFormViaSync_Components()
280279 new ComplexFormComponent ( )
281280 {
282281 ComponentEntryId = component1 . Id ,
283- ComponentHeadword = component1 . Headword ( ) ,
282+ ComponentHeadword = component1 . HeadwordText ( ) ,
284283 ComplexFormEntryId = complexFormId ,
285284 ComplexFormHeadword = "complex form"
286285 }
287286 ]
288287 } ) ;
289288 var complexFormAfter = complexForm . Copy ( ) ;
290289 complexFormAfter . Components [ 0 ] . ComponentEntryId = component2 . Id ;
291- complexFormAfter . Components [ 0 ] . ComponentHeadword = component2 . Headword ( ) ;
290+ complexFormAfter . Components [ 0 ] . ComponentHeadword = component2 . HeadwordText ( ) ;
292291
293292 await EntrySync . SyncFull ( complexForm , complexFormAfter , Api ) ;
294293
@@ -315,13 +314,13 @@ public async Task CanChangeComplexFormViaSync_ComplexForms()
315314 ComponentEntryId = componentId ,
316315 ComponentHeadword = "component" ,
317316 ComplexFormEntryId = complexForm1 . Id ,
318- ComplexFormHeadword = complexForm1 . Headword ( )
317+ ComplexFormHeadword = complexForm1 . HeadwordText ( )
319318 }
320319 ]
321320 } ) ;
322321 var componentAter = component . Copy ( ) ;
323322 componentAter . ComplexForms [ 0 ] . ComplexFormEntryId = complexForm2 . Id ;
324- componentAter . ComplexForms [ 0 ] . ComplexFormHeadword = complexForm2 . Headword ( ) ;
323+ componentAter . ComplexForms [ 0 ] . ComplexFormHeadword = complexForm2 . HeadwordText ( ) ;
325324
326325 await EntrySync . SyncFull ( component , componentAter , Api ) ;
327326
@@ -413,11 +412,13 @@ public async Task CanSyncNewEntryReferencedByExistingEntry()
413412 // assert
414413 var actualExistingEntry = await Api . GetEntry ( existingEntryAfter . Id ) ;
415414 actualExistingEntry . Should ( ) . BeEquivalentTo ( existingEntryAfter , options => options
415+ . Excluding ( e => e . Headword )
416416 . For ( e => e . ComplexForms ) . Exclude ( c => c . Id )
417417 . For ( e => e . ComplexForms ) . Exclude ( c => c . Order ) ) ;
418418
419419 var actualNewEntry = await Api . GetEntry ( newEntry . Id ) ;
420420 actualNewEntry . Should ( ) . BeEquivalentTo ( newEntry , options => options
421+ . Excluding ( e => e . Headword )
421422 . Excluding ( e => e . ComplexFormTypes ) // LibLcm automatically creates a complex form type. Should we?
422423 . For ( e => e . Components ) . Exclude ( c => c . Id )
423424 . For ( e => e . Components ) . Exclude ( c => c . Order ) ) ;
@@ -487,13 +488,13 @@ public async Task SyncWithoutComplexFormsAndComponents_CorrectlySyncsUpdatedEntr
487488 // assert
488489 var actualComponent = await Api . GetEntry ( componentAfter . Id ) ;
489490 actualComponent . Should ( ) . BeEquivalentTo ( componentAfter ,
490- options => options . Excluding ( e => e . ComplexForms ) ) ;
491+ options => options . Excluding ( e => e . ComplexForms ) . Excluding ( e => e . Headword ) ) ;
491492 actualComponent . ComplexForms . Should ( ) . BeEmpty ( ) ;
492493
493494 var actualComplexForm = await Api . GetEntry ( complexForm . Id ) ;
494495 addedComplexForm . Should ( ) . BeEquivalentTo ( actualComplexForm ) ;
495496 actualComplexForm . Should ( ) . BeEquivalentTo ( complexForm ,
496- options => options . Excluding ( e => e . Components ) ) ;
497+ options => options . Excluding ( e => e . Components ) . Excluding ( e => e . Headword ) ) ;
497498 actualComplexForm . Components . Should ( ) . BeEmpty ( ) ;
498499 }
499500
@@ -526,13 +527,13 @@ public async Task SyncWithoutComplexFormsAndComponents_CorrectlySyncsAddedEntrie
526527 var actualComponent = await Api . GetEntry ( component . Id ) ;
527528 addedComponent . Should ( ) . BeEquivalentTo ( actualComponent ) ;
528529 actualComponent . Should ( ) . BeEquivalentTo ( component ,
529- options => options . Excluding ( e => e . ComplexForms ) ) ;
530+ options => options . Excluding ( e => e . ComplexForms ) . Excluding ( e => e . Headword ) ) ;
530531 actualComponent . ComplexForms . Should ( ) . BeEmpty ( ) ;
531532
532533 var actualComplexForm = await Api . GetEntry ( complexForm . Id ) ;
533534 addedComplexForm . Should ( ) . BeEquivalentTo ( actualComplexForm ) ;
534535 actualComplexForm . Should ( ) . BeEquivalentTo ( complexForm ,
535- options => options . Excluding ( e => e . Components ) ) ;
536+ options => options . Excluding ( e => e . Components ) . Excluding ( e => e . Headword ) ) ;
536537 actualComplexForm . Components . Should ( ) . BeEmpty ( ) ;
537538 }
538539
@@ -636,15 +637,15 @@ public async Task SyncComplexFormsAndComponents_MovesComponentsToCorrectPosition
636637 new ComplexFormComponent ( )
637638 {
638639 ComponentEntryId = componentA . Id ,
639- ComponentHeadword = componentA . Headword ( ) ,
640+ ComponentHeadword = componentA . HeadwordText ( ) ,
640641 ComplexFormEntryId = complexFormId ,
641642 ComplexFormHeadword = "complex form" ,
642643 Order = 1
643644 } ,
644645 new ComplexFormComponent ( )
645646 {
646647 ComponentEntryId = componentB . Id ,
647- ComponentHeadword = componentB . Headword ( ) ,
648+ ComponentHeadword = componentB . HeadwordText ( ) ,
648649 ComplexFormEntryId = complexFormId ,
649650 ComplexFormHeadword = "complex form" ,
650651 Order = 2
0 commit comments