Skip to content

Commit 71cb27f

Browse files
rmunnmyieye
authored andcommitted
Sync morph type data
Implement CRUD for MorphTypeData, add DB migration Make LeadingToken and TrailingToken nullable Register JsonPatchChange for morphTypeData Reject MorphTypeData updates that change MorphType Do not allow ANY JsonPatch changes to MorphType Rename MorphType enum to MorphTypeKind Rename MorphTypeData to MorphType LeadingToken -> Prefix, TrailingToken -> Postfix Matches the names from liblcm, which may help reduce confusion.
1 parent 73e4ecd commit 71cb27f

65 files changed

Lines changed: 127966 additions & 238 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/FwLite/FwDataMiniLcmBridge/Api/FwDataMiniLcmApi.cs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ await Cache.DoUsingNewOrCurrentUOW("Delete Complex Form Type",
541541
});
542542
}
543543

544-
public IAsyncEnumerable<MorphTypeData> GetAllMorphTypeData()
544+
public IAsyncEnumerable<MorphType> GetMorphTypes()
545545
{
546546
return
547547
MorphTypeRepository
@@ -550,35 +550,44 @@ public IAsyncEnumerable<MorphTypeData> GetAllMorphTypeData()
550550
.Select(FromLcmMorphType);
551551
}
552552

553-
public Task<MorphTypeData?> GetMorphTypeData(Guid id)
553+
public Task<MorphType?> GetMorphType(Guid id)
554554
{
555555
MorphTypeRepository.TryGetObject(id, out var lcmMorphType);
556-
if (lcmMorphType is null) return Task.FromResult<MorphTypeData?>(null);
557-
return Task.FromResult<MorphTypeData?>(FromLcmMorphType(lcmMorphType));
556+
if (lcmMorphType is null) return Task.FromResult<MorphType?>(null);
557+
return Task.FromResult<MorphType?>(FromLcmMorphType(lcmMorphType));
558558
}
559559

560-
internal MorphTypeData FromLcmMorphType(IMoMorphType morphType)
560+
public Task<MorphType?> GetMorphType(MorphTypeKind kind)
561561
{
562-
return new MorphTypeData
562+
var guid = LcmHelpers.ToLcmMorphTypeId(kind);
563+
if (guid is null) return Task.FromResult<MorphType?>(null);
564+
MorphTypeRepository.TryGetObject(guid.Value, out var lcmMorphType);
565+
if (lcmMorphType is null) return Task.FromResult<MorphType?>(null);
566+
return Task.FromResult<MorphType?>(FromLcmMorphType(lcmMorphType));
567+
}
568+
569+
internal MorphType FromLcmMorphType(IMoMorphType morphType)
570+
{
571+
return new MorphType
563572
{
564573
Id = morphType.Guid,
565-
MorphType = LcmHelpers.FromLcmMorphType(morphType),
574+
Kind = LcmHelpers.FromLcmMorphType(morphType),
566575
Name = FromLcmMultiString(morphType.Name),
567576
Abbreviation = FromLcmMultiString(morphType.Abbreviation),
568577
Description = FromLcmMultiString(morphType.Description),
569-
LeadingToken = morphType.Prefix,
570-
TrailingToken = morphType.Postfix,
578+
Prefix = morphType.Prefix,
579+
Postfix = morphType.Postfix,
571580
SecondaryOrder = morphType.SecondaryOrder,
572581
};
573582
}
574583

575-
public Task<MorphTypeData> CreateMorphTypeData(MorphTypeData morphTypeData)
584+
public Task<MorphType> CreateMorphType(MorphType morphType)
576585
{
577586
// Creating new morph types not allowed in FwData projects, so silently ignore operation
578-
return Task.FromResult(morphTypeData);
587+
return Task.FromResult(morphType);
579588
}
580589

581-
public Task<MorphTypeData> UpdateMorphTypeData(Guid id, UpdateObjectInput<MorphTypeData> update)
590+
public Task<MorphType> UpdateMorphType(Guid id, UpdateObjectInput<MorphType> update)
582591
{
583592
var lcmMorphType = MorphTypeRepository.GetObject(id);
584593
if (lcmMorphType is null) throw new NullReferenceException($"unable to find morph type with id {id}");
@@ -587,19 +596,19 @@ public Task<MorphTypeData> UpdateMorphTypeData(Guid id, UpdateObjectInput<MorphT
587596
Cache.ServiceLocator.ActionHandler,
588597
() =>
589598
{
590-
var updateProxy = new UpdateMorphTypeDataProxy(lcmMorphType, this);
599+
var updateProxy = new UpdateMorphTypeProxy(lcmMorphType, this);
591600
update.Apply(updateProxy);
592601
});
593602
return Task.FromResult(FromLcmMorphType(lcmMorphType));
594603
}
595604

596-
public async Task<MorphTypeData> UpdateMorphTypeData(MorphTypeData before, MorphTypeData after, IMiniLcmApi? api = null)
605+
public async Task<MorphType> UpdateMorphType(MorphType before, MorphType after, IMiniLcmApi? api = null)
597606
{
598-
await MorphTypeDataSync.Sync(before, after, api ?? this);
599-
return await GetMorphTypeData(after.Id) ?? throw new NullReferenceException("unable to find morph type with id " + after.Id);
607+
await MorphTypeSync.Sync(before, after, api ?? this);
608+
return await GetMorphType(after.Id) ?? throw new NullReferenceException("unable to find morph type with id " + after.Id);
600609
}
601610

602-
public Task DeleteMorphTypeData(Guid id)
611+
public Task DeleteMorphType(Guid id)
603612
{
604613
// Deleting morph types not allowed in FwData projects, so silently ignore operation
605614
return Task.CompletedTask;

backend/FwLite/FwDataMiniLcmBridge/Api/LcmHelpers.cs

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -85,62 +85,62 @@ internal static bool SearchValue(this ITsMultiString multiString, string value)
8585
'\u0640', // Arabic Tatweel
8686
];
8787

88-
internal static MorphType FromLcmMorphType(IMoMorphType? morphType)
88+
internal static MorphTypeKind FromLcmMorphType(IMoMorphType? morphType)
8989
{
9090
var lcmMorphTypeId = morphType?.Id.Guid;
9191

9292
return lcmMorphTypeId switch
9393
{
94-
null => MorphType.Unknown,
94+
null => MorphTypeKind.Unknown,
9595
// Can't switch on Guids since they're not compile-type constants, but thankfully pattern matching works
96-
Guid g when g == MoMorphTypeTags.kguidMorphBoundRoot => MorphType.BoundRoot,
97-
Guid g when g == MoMorphTypeTags.kguidMorphBoundStem => MorphType.BoundStem,
98-
Guid g when g == MoMorphTypeTags.kguidMorphCircumfix => MorphType.Circumfix,
99-
Guid g when g == MoMorphTypeTags.kguidMorphClitic => MorphType.Clitic,
100-
Guid g when g == MoMorphTypeTags.kguidMorphEnclitic => MorphType.Enclitic,
101-
Guid g when g == MoMorphTypeTags.kguidMorphInfix => MorphType.Infix,
102-
Guid g when g == MoMorphTypeTags.kguidMorphParticle => MorphType.Particle,
103-
Guid g when g == MoMorphTypeTags.kguidMorphPrefix => MorphType.Prefix,
104-
Guid g when g == MoMorphTypeTags.kguidMorphProclitic => MorphType.Proclitic,
105-
Guid g when g == MoMorphTypeTags.kguidMorphRoot => MorphType.Root,
106-
Guid g when g == MoMorphTypeTags.kguidMorphSimulfix => MorphType.Simulfix,
107-
Guid g when g == MoMorphTypeTags.kguidMorphStem => MorphType.Stem,
108-
Guid g when g == MoMorphTypeTags.kguidMorphSuffix => MorphType.Suffix,
109-
Guid g when g == MoMorphTypeTags.kguidMorphSuprafix => MorphType.Suprafix,
110-
Guid g when g == MoMorphTypeTags.kguidMorphInfixingInterfix => MorphType.InfixingInterfix,
111-
Guid g when g == MoMorphTypeTags.kguidMorphPrefixingInterfix => MorphType.PrefixingInterfix,
112-
Guid g when g == MoMorphTypeTags.kguidMorphSuffixingInterfix => MorphType.SuffixingInterfix,
113-
Guid g when g == MoMorphTypeTags.kguidMorphPhrase => MorphType.Phrase,
114-
Guid g when g == MoMorphTypeTags.kguidMorphDiscontiguousPhrase => MorphType.DiscontiguousPhrase,
115-
_ => MorphType.Other,
96+
Guid g when g == MoMorphTypeTags.kguidMorphBoundRoot => MorphTypeKind.BoundRoot,
97+
Guid g when g == MoMorphTypeTags.kguidMorphBoundStem => MorphTypeKind.BoundStem,
98+
Guid g when g == MoMorphTypeTags.kguidMorphCircumfix => MorphTypeKind.Circumfix,
99+
Guid g when g == MoMorphTypeTags.kguidMorphClitic => MorphTypeKind.Clitic,
100+
Guid g when g == MoMorphTypeTags.kguidMorphEnclitic => MorphTypeKind.Enclitic,
101+
Guid g when g == MoMorphTypeTags.kguidMorphInfix => MorphTypeKind.Infix,
102+
Guid g when g == MoMorphTypeTags.kguidMorphParticle => MorphTypeKind.Particle,
103+
Guid g when g == MoMorphTypeTags.kguidMorphPrefix => MorphTypeKind.Prefix,
104+
Guid g when g == MoMorphTypeTags.kguidMorphProclitic => MorphTypeKind.Proclitic,
105+
Guid g when g == MoMorphTypeTags.kguidMorphRoot => MorphTypeKind.Root,
106+
Guid g when g == MoMorphTypeTags.kguidMorphSimulfix => MorphTypeKind.Simulfix,
107+
Guid g when g == MoMorphTypeTags.kguidMorphStem => MorphTypeKind.Stem,
108+
Guid g when g == MoMorphTypeTags.kguidMorphSuffix => MorphTypeKind.Suffix,
109+
Guid g when g == MoMorphTypeTags.kguidMorphSuprafix => MorphTypeKind.Suprafix,
110+
Guid g when g == MoMorphTypeTags.kguidMorphInfixingInterfix => MorphTypeKind.InfixingInterfix,
111+
Guid g when g == MoMorphTypeTags.kguidMorphPrefixingInterfix => MorphTypeKind.PrefixingInterfix,
112+
Guid g when g == MoMorphTypeTags.kguidMorphSuffixingInterfix => MorphTypeKind.SuffixingInterfix,
113+
Guid g when g == MoMorphTypeTags.kguidMorphPhrase => MorphTypeKind.Phrase,
114+
Guid g when g == MoMorphTypeTags.kguidMorphDiscontiguousPhrase => MorphTypeKind.DiscontiguousPhrase,
115+
// Non-canonical Guids should not be guessed, but be mapped to Unknown
116+
_ => MorphTypeKind.Unknown,
116117
};
117118
}
118119

119-
internal static Guid? ToLcmMorphTypeId(MorphType morphType)
120+
internal static Guid? ToLcmMorphTypeId(MorphTypeKind morphType)
120121
{
121122
return morphType switch
122123
{
123-
MorphType.BoundRoot => MoMorphTypeTags.kguidMorphBoundRoot,
124-
MorphType.BoundStem => MoMorphTypeTags.kguidMorphBoundStem,
125-
MorphType.Circumfix => MoMorphTypeTags.kguidMorphCircumfix,
126-
MorphType.Clitic => MoMorphTypeTags.kguidMorphClitic,
127-
MorphType.Enclitic => MoMorphTypeTags.kguidMorphEnclitic,
128-
MorphType.Infix => MoMorphTypeTags.kguidMorphInfix,
129-
MorphType.Particle => MoMorphTypeTags.kguidMorphParticle,
130-
MorphType.Prefix => MoMorphTypeTags.kguidMorphPrefix,
131-
MorphType.Proclitic => MoMorphTypeTags.kguidMorphProclitic,
132-
MorphType.Root => MoMorphTypeTags.kguidMorphRoot,
133-
MorphType.Simulfix => MoMorphTypeTags.kguidMorphSimulfix,
134-
MorphType.Stem => MoMorphTypeTags.kguidMorphStem,
135-
MorphType.Suffix => MoMorphTypeTags.kguidMorphSuffix,
136-
MorphType.Suprafix => MoMorphTypeTags.kguidMorphSuprafix,
137-
MorphType.InfixingInterfix => MoMorphTypeTags.kguidMorphInfixingInterfix,
138-
MorphType.PrefixingInterfix => MoMorphTypeTags.kguidMorphPrefixingInterfix,
139-
MorphType.SuffixingInterfix => MoMorphTypeTags.kguidMorphSuffixingInterfix,
140-
MorphType.Phrase => MoMorphTypeTags.kguidMorphPhrase,
141-
MorphType.DiscontiguousPhrase => MoMorphTypeTags.kguidMorphDiscontiguousPhrase,
142-
MorphType.Unknown => null,
143-
MorphType.Other => null, // Note that this will not round-trip with FromLcmMorphType
124+
MorphTypeKind.BoundRoot => MoMorphTypeTags.kguidMorphBoundRoot,
125+
MorphTypeKind.BoundStem => MoMorphTypeTags.kguidMorphBoundStem,
126+
MorphTypeKind.Circumfix => MoMorphTypeTags.kguidMorphCircumfix,
127+
MorphTypeKind.Clitic => MoMorphTypeTags.kguidMorphClitic,
128+
MorphTypeKind.Enclitic => MoMorphTypeTags.kguidMorphEnclitic,
129+
MorphTypeKind.Infix => MoMorphTypeTags.kguidMorphInfix,
130+
MorphTypeKind.Particle => MoMorphTypeTags.kguidMorphParticle,
131+
MorphTypeKind.Prefix => MoMorphTypeTags.kguidMorphPrefix,
132+
MorphTypeKind.Proclitic => MoMorphTypeTags.kguidMorphProclitic,
133+
MorphTypeKind.Root => MoMorphTypeTags.kguidMorphRoot,
134+
MorphTypeKind.Simulfix => MoMorphTypeTags.kguidMorphSimulfix,
135+
MorphTypeKind.Stem => MoMorphTypeTags.kguidMorphStem,
136+
MorphTypeKind.Suffix => MoMorphTypeTags.kguidMorphSuffix,
137+
MorphTypeKind.Suprafix => MoMorphTypeTags.kguidMorphSuprafix,
138+
MorphTypeKind.InfixingInterfix => MoMorphTypeTags.kguidMorphInfixingInterfix,
139+
MorphTypeKind.PrefixingInterfix => MoMorphTypeTags.kguidMorphPrefixingInterfix,
140+
MorphTypeKind.SuffixingInterfix => MoMorphTypeTags.kguidMorphSuffixingInterfix,
141+
MorphTypeKind.Phrase => MoMorphTypeTags.kguidMorphPhrase,
142+
MorphTypeKind.DiscontiguousPhrase => MoMorphTypeTags.kguidMorphDiscontiguousPhrase,
143+
MorphTypeKind.Unknown => null,
144144
_ => null,
145145
};
146146
}
@@ -212,47 +212,47 @@ internal static string PickText(this ICmObject obj, ITsMultiString multiString,
212212
return multiString.get_String(wsHandle)?.Text ?? string.Empty;
213213
}
214214

215-
internal static IMoForm CreateLexemeForm(this LcmCache cache, MorphType morphType)
215+
internal static IMoForm CreateLexemeForm(this LcmCache cache, MorphTypeKind morphType)
216216
{
217217
return
218218
IsAffixMorphType(morphType)
219219
? cache.ServiceLocator.GetInstance<IMoAffixAllomorphFactory>().Create()
220220
: cache.ServiceLocator.GetInstance<IMoStemAllomorphFactory>().Create();
221221
}
222222

223-
internal static bool IsAffixMorphType(MorphType morphType)
223+
internal static bool IsAffixMorphType(MorphTypeKind morphType)
224224
{
225225
return morphType switch
226226
{
227227
// Affixes of all types should use the Affix morph type factory
228-
MorphType.Circumfix => true,
229-
MorphType.Infix => true,
230-
MorphType.Prefix => true,
231-
MorphType.Simulfix => true,
232-
MorphType.Suffix => true,
233-
MorphType.Suprafix => true,
234-
MorphType.InfixingInterfix => true,
235-
MorphType.PrefixingInterfix => true,
236-
MorphType.SuffixingInterfix => true,
228+
MorphTypeKind.Circumfix => true,
229+
MorphTypeKind.Infix => true,
230+
MorphTypeKind.Prefix => true,
231+
MorphTypeKind.Simulfix => true,
232+
MorphTypeKind.Suffix => true,
233+
MorphTypeKind.Suprafix => true,
234+
MorphTypeKind.InfixingInterfix => true,
235+
MorphTypeKind.PrefixingInterfix => true,
236+
MorphTypeKind.SuffixingInterfix => true,
237237

238238
// Everything else should use the Stem morph type factory
239239
_ => false,
240240
};
241241
}
242242

243-
internal static ILexEntry CreateEntry(this LcmCache cache, Guid id, MorphType morphType)
243+
internal static ILexEntry CreateEntry(this LcmCache cache, Guid id, MorphTypeKind morphType)
244244
{
245245
var lexEntry = cache.ServiceLocator.GetInstance<ILexEntryFactory>().Create(id,
246246
cache.ServiceLocator.GetInstance<ILangProjectRepository>().Singleton.LexDbOA);
247247
SetLexemeForm(lexEntry, morphType, cache);
248248
return lexEntry;
249249
}
250250

251-
internal static IMoForm SetLexemeForm(ILexEntry lexEntry, MorphType morphType, LcmCache cache)
251+
internal static IMoForm SetLexemeForm(ILexEntry lexEntry, MorphTypeKind morphType, LcmCache cache)
252252
{
253253
lexEntry.LexemeFormOA = cache.CreateLexemeForm(morphType);
254254
//must be done after the IMoForm is set on the LexemeForm property
255-
var lcmMorphType = ToLcmMorphTypeId(morphType) ?? ToLcmMorphTypeId(MorphType.Stem);
255+
var lcmMorphType = ToLcmMorphTypeId(morphType) ?? ToLcmMorphTypeId(MorphTypeKind.Stem);
256256
lexEntry.LexemeFormOA.MorphTypeRA = cache.ServiceLocator.GetInstance<IMoMorphTypeRepository>().GetObject(lcmMorphType!.Value);
257257
return lexEntry.LexemeFormOA;
258258
}

backend/FwLite/FwDataMiniLcmBridge/Api/UpdateProxy/UpdateEntryProxy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override RichMultiString LiteralMeaning
4141
set => throw new NotImplementedException();
4242
}
4343

44-
public override MorphType MorphType
44+
public override MorphTypeKind MorphType
4545
{
4646
get => throw new NotImplementedException();
4747
set => Console.WriteLine("setting MorphType not implemented"); // Not throwing, for now

backend/FwLite/FwDataMiniLcmBridge/Api/UpdateProxy/UpdateMorphTypeDataProxy.cs renamed to backend/FwLite/FwDataMiniLcmBridge/Api/UpdateProxy/UpdateMorphTypeProxy.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
namespace FwDataMiniLcmBridge.Api.UpdateProxy;
55

6-
public class UpdateMorphTypeDataProxy : MorphTypeData
6+
public class UpdateMorphTypeProxy : MorphType
77
{
88
private readonly IMoMorphType _lcmMorphType;
99
private readonly FwDataMiniLcmApi _lexboxLcmApi;
1010

11-
public UpdateMorphTypeDataProxy(IMoMorphType lcmMorphType, FwDataMiniLcmApi lexboxLcmApi)
11+
public UpdateMorphTypeProxy(IMoMorphType lcmMorphType, FwDataMiniLcmApi lexboxLcmApi)
1212
{
1313
_lcmMorphType = lcmMorphType;
1414
Id = lcmMorphType.Guid;
@@ -33,13 +33,13 @@ public override RichMultiString Description
3333
set => throw new NotImplementedException();
3434
}
3535

36-
public override string LeadingToken
36+
public override string? Prefix
3737
{
3838
get => _lcmMorphType.Prefix;
3939
set => _lcmMorphType.Prefix = value;
4040
}
4141

42-
public override string TrailingToken
42+
public override string? Postfix
4343
{
4444
get => _lcmMorphType.Postfix;
4545
set => _lcmMorphType.Postfix = value;

backend/FwLite/FwDataMiniLcmBridge/FwDataMiniLcmBridge.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
</ItemGroup>
1818
<ItemGroup>
1919
<InternalsVisibleTo Include="FwDataMiniLcmBridge.Tests" />
20+
<InternalsVisibleTo Include="FwLiteProjectSync.Tests" />
2021
<InternalsVisibleTo Include="LcmDebugger" />
2122
</ItemGroup>
2223
<ItemGroup>

backend/FwLite/FwLiteProjectSync.Tests/EntrySyncTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ public async Task FwDataApiDoesNotUpdateMorphType()
3333
var entry = await Api.CreateEntry(new()
3434
{
3535
LexemeForm = { { "en", "morph-type-test" } },
36-
MorphType = MorphType.BoundStem
36+
MorphType = MorphTypeKind.BoundStem
3737
});
3838

3939
// act
4040
var updatedEntry = entry.Copy();
41-
updatedEntry.MorphType = MorphType.Suffix;
41+
updatedEntry.MorphType = MorphTypeKind.Suffix;
4242
await EntrySync.SyncFull(entry, updatedEntry, Api);
4343

4444
// assert
4545
var actual = await Api.GetEntry(entry.Id);
4646
actual.Should().NotBeNull();
47-
actual.MorphType.Should().Be(MorphType.BoundStem);
47+
actual.MorphType.Should().Be(MorphTypeKind.BoundStem);
4848
}
4949
}
5050

backend/FwLite/FwLiteProjectSync.Tests/Import/ResumableTests.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ public async Task ImportProject_IsResumable_AcrossRandomFailures()
3838
}).ToList();
3939
var expectedPartsOfSpeech = Enumerable.Range(1, 10)
4040
.Select(i => new PartOfSpeech { Id = Guid.NewGuid(), Name = { ["en"] = $"pos{i}" } }).ToList();
41+
var expectedMorphTypes = Enum.GetValues<MorphTypeKind>()
42+
.Select(typ => new MorphType()
43+
{
44+
Id = Guid.NewGuid(),
45+
Name = new() { ["en"] = $"Test Morph Type {(int)typ} {typ}" },
46+
Abbreviation = new() { ["en"] = $"Tst MrphTyp{(int)typ}" },
47+
Description = new() { { "en", new RichString($"test desc for {typ}") } },
48+
Prefix = null,
49+
Postfix = null,
50+
Kind = typ,
51+
SecondaryOrder = 0
52+
}).ToList();
4153

4254
var mockFrom = new Mock<IMiniLcmApi>();
4355
IMiniLcmApi mockTo = new UnreliableApi(
@@ -80,6 +92,8 @@ public async Task ImportProject_IsResumable_AcrossRandomFailures()
8092
Id = Guid.NewGuid(),
8193
Name = new(){ ["en"] = "Test Complex Form Type" }
8294
}]));
95+
mockFrom.Setup(f => f.GetMorphTypes())
96+
.Returns(MockAsyncEnumerable(expectedMorphTypes));
8397
mockFrom.Setup(f => f.GetSemanticDomains())
8498
.Returns(MockAsyncEnumerable([new SemanticDomain()
8599
{
@@ -95,7 +109,7 @@ public async Task ImportProject_IsResumable_AcrossRandomFailures()
95109
);
96110

97111
// Act: retry until all are imported
98-
var maxTries = 20;
112+
var maxTries = 30;
99113
for (var attempt = 0; attempt < maxTries; attempt++)
100114
{
101115
try
@@ -111,10 +125,14 @@ public async Task ImportProject_IsResumable_AcrossRandomFailures()
111125

112126
var createdEntries = await mockTo.GetAllEntries().ToArrayAsync();
113127
var createdPartsOfSpeech = await mockTo.GetPartsOfSpeech().ToArrayAsync();
128+
var createdMorphTypes = await mockTo.GetMorphTypes().ToArrayAsync();
114129

115130
// Assert
116131
createdPartsOfSpeech.Select(pos => pos.Name["en"]).Should().BeEquivalentTo(expectedPartsOfSpeech.Select(p => p.Name["en"]));
117132
createdEntries.Select(e => e.LexemeForm["en"]).Should().BeEquivalentTo(expectedEntries.Select(e => e.LexemeForm["en"]));
133+
createdMorphTypes.Select(e => e.Name["en"]).Should().BeEquivalentTo(expectedMorphTypes.Select(e => e.Name["en"]));
134+
createdMorphTypes.Select(e => e.Kind).Should().BeEquivalentTo(expectedMorphTypes.Select(e => e.Kind));
135+
118136
}
119137

120138

@@ -183,6 +201,11 @@ Task<ComplexFormType> IMiniLcmWriteApi.CreateComplexFormType(ComplexFormType com
183201
ResumableTests.MaybeThrowRandom(random, 0.2);
184202
return _api.CreateComplexFormType(complexFormType);
185203
}
204+
Task<MorphType> IMiniLcmWriteApi.CreateMorphType(MorphType morphType)
205+
{
206+
ResumableTests.MaybeThrowRandom(random, 0.02);
207+
return _api.CreateMorphType(morphType);
208+
}
186209
Task<SemanticDomain> IMiniLcmWriteApi.CreateSemanticDomain(SemanticDomain semanticDomain)
187210
{
188211
ResumableTests.MaybeThrowRandom(random, 0.2);

0 commit comments

Comments
 (0)