|
1 | 1 | using FwDataMiniLcmBridge.Api; |
2 | 2 | using FwDataMiniLcmBridge.Tests.Fixtures; |
3 | 3 | using MiniLcm.Models; |
| 4 | +using SIL.LCModel; |
4 | 5 | using SIL.LCModel.Infrastructure; |
5 | 6 |
|
6 | 7 | namespace FwDataMiniLcmBridge.Tests.MiniLcmTests; |
@@ -81,4 +82,31 @@ public async Task SetPartOfSpeech_WithNullMorphoSyntaxAnalysisRA_ToNull() |
81 | 82 | retrievedEntry.Should().NotBeNull(); |
82 | 83 | retrievedEntry!.PartOfSpeechId.Should().BeNull(); |
83 | 84 | } |
| 85 | + |
| 86 | + [Fact] |
| 87 | + public async Task GetPartsOfSpeech_DoesNotReturnReversalIndexPos() |
| 88 | + { |
| 89 | + // Arrange |
| 90 | + var fwApi = (FwDataMiniLcmApi)BaseApi; |
| 91 | + var reversalIndexRepository = fwApi.Cache.ServiceLocator.GetInstance<IReversalIndexRepository>(); |
| 92 | + var analysisWs = fwApi.Cache.DefaultAnalWs; |
| 93 | + |
| 94 | + var reversalPosGuid = Guid.NewGuid(); |
| 95 | + UndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW("Create Reversal Index POS", |
| 96 | + "Remove Reversal Index POS", |
| 97 | + fwApi.Cache.ServiceLocator.ActionHandler, |
| 98 | + () => |
| 99 | + { |
| 100 | + var reversalIndex = reversalIndexRepository.FindOrCreateIndexForWs(analysisWs); |
| 101 | + var posFactory = fwApi.Cache.ServiceLocator.GetInstance<IPartOfSpeechFactory>(); |
| 102 | + var reversalPos = posFactory.Create(reversalPosGuid, reversalIndex.PartsOfSpeechOA); |
| 103 | + reversalPos.Name.set_String(analysisWs, "Reversal Test POS"); |
| 104 | + }); |
| 105 | + |
| 106 | + // Act |
| 107 | + var partsOfSpeech = await Api.GetPartsOfSpeech().ToArrayAsync(); |
| 108 | + |
| 109 | + // Assert |
| 110 | + partsOfSpeech.Should().NotContain(pos => pos.Id == reversalPosGuid); |
| 111 | + } |
84 | 112 | } |
0 commit comments