Skip to content

Commit

Permalink
Fix merge of SF-3097 (#2880) from master
Browse files Browse the repository at this point in the history
  • Loading branch information
pmachapman committed Dec 5, 2024
1 parent 088c054 commit ea8054e
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ public async Task EnsureTranslationEngineExistsAsync_ProjectDeletedBeforeExecuti
CancellationToken.None
)
);
env.ParatextService.DidNotReceiveWithAnyArgs().GetLanguageId(Arg.Any<UserSecret>(), Arg.Any<string>());
env.ParatextService.DidNotReceiveWithAnyArgs().GetWritingSystem(Arg.Any<UserSecret>(), Arg.Any<string>());
}

[Test]
Expand All @@ -889,8 +889,8 @@ public async Task EnsureTranslationEngineExistsAsync_ProjectDeletedDuringExecuti
SFProjectSecret projectSecret = env.ProjectSecrets.Get(Project03);

// Delete the project mid-sync (normally this would be done out of process)
env.ParatextService.GetLanguageId(Arg.Any<UserSecret>(), Arg.Any<string>())
.Returns(string.Empty)
env.ParatextService.GetWritingSystem(Arg.Any<UserSecret>(), Arg.Any<string>())
.Returns(new WritingSystem())
.AndDoes(_ => projectDoc.DeleteAsync());

// SUT
Expand All @@ -904,7 +904,7 @@ public async Task EnsureTranslationEngineExistsAsync_ProjectDeletedDuringExecuti
CancellationToken.None
)
);
env.ParatextService.Received(1).GetLanguageId(Arg.Any<UserSecret>(), Arg.Any<string>());
env.ParatextService.Received(1).GetWritingSystem(Arg.Any<UserSecret>(), Arg.Any<string>());
}

[Test]
Expand Down Expand Up @@ -951,8 +951,10 @@ public async Task EnsureTranslationEngineExistsAsync_SetsUpTheProjectAndTranslat
env.Service.Configure()
.CreateServalProjectAsync(Arg.Any<SFProject>(), preTranslate: true, CancellationToken.None)
.Returns(Task.FromResult(TranslationEngine02));
env.ParatextService.GetLanguageId(Arg.Any<UserSecret>(), Paratext01).Returns(sourceLanguage);
env.ParatextService.GetLanguageId(Arg.Any<UserSecret>(), Paratext03).Returns(targetLanguage);
env.ParatextService.GetWritingSystem(Arg.Any<UserSecret>(), Paratext01)
.Returns(new WritingSystem { Tag = sourceLanguage });
env.ParatextService.GetWritingSystem(Arg.Any<UserSecret>(), Paratext03)
.Returns(new WritingSystem { Tag = targetLanguage });

// Retrieve required objects
await using IConnection connection = await env.RealtimeService.ConnectAsync();
Expand Down Expand Up @@ -988,8 +990,10 @@ public async Task EnsureTranslationEngineExistsAsync_SetsUpTheProjectAndTranslat
env.Service.Configure()
.CreateServalProjectAsync(Arg.Any<SFProject>(), preTranslate: false, CancellationToken.None)
.Returns(Task.FromResult(TranslationEngine02));
env.ParatextService.GetLanguageId(Arg.Any<UserSecret>(), Paratext01).Returns(sourceLanguage);
env.ParatextService.GetLanguageId(Arg.Any<UserSecret>(), Paratext03).Returns(targetLanguage);
env.ParatextService.GetWritingSystem(Arg.Any<UserSecret>(), Paratext01)
.Returns(new WritingSystem { Tag = sourceLanguage });
env.ParatextService.GetWritingSystem(Arg.Any<UserSecret>(), Paratext03)
.Returns(new WritingSystem { Tag = targetLanguage });

// Retrieve required objects
await using IConnection connection = await env.RealtimeService.ConnectAsync();
Expand Down Expand Up @@ -1069,7 +1073,7 @@ public async Task EnsureTranslationEngineExistsAsync_TranslationEngineCouldNotBe
CancellationToken.None
)
);
env.ParatextService.DidNotReceiveWithAnyArgs().GetLanguageId(Arg.Any<UserSecret>(), Arg.Any<string>());
env.ParatextService.DidNotReceiveWithAnyArgs().GetWritingSystem(Arg.Any<UserSecret>(), Arg.Any<string>());
}

[Test]
Expand Down

0 comments on commit ea8054e

Please sign in to comment.