Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Dec 5, 2023
1 parent a495958 commit 963766e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,8 @@ public async Task StartBuildForEngineByIdAsync(IEnumerable<string> scope, int ex
{
Pretranslate = new List<PretranslateCorpusConfig> { ptcc },
TrainOn = new List<TrainingCorpusConfig> { tcc },
Options = "{\"max_steps\":10}"
Options =
"{\"max_steps\":10, \"use_key_terms\":false, \"some_double\":10.5, \"some_string\":\"string\"}"
};
TranslationBuild resultAfterStart;
Assert.ThrowsAsync<ServalApiException>(async () =>
Expand Down
39 changes: 39 additions & 0 deletions tests/Serval.Translation.Tests/Services/PlatformServiceTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Google.Protobuf.WellKnownTypes;
using MassTransit;
using Serval.Translation.V1;
using SIL.ObjectModel;

namespace Serval.Translation.Services;

[TestFixture]
public class PlatformServiceTests
{
[Test]
public async Task TestBuildStateTransitionsAsync() { }

Check warning on line 12 in tests/Serval.Translation.Tests/Services/PlatformServiceTests.cs

View workflow job for this annotation

GitHub Actions / Build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 12 in tests/Serval.Translation.Tests/Services/PlatformServiceTests.cs

View workflow job for this annotation

GitHub Actions / Build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

[Test]
public async Task UpdateBuildStatusAsync() { }

Check warning on line 15 in tests/Serval.Translation.Tests/Services/PlatformServiceTests.cs

View workflow job for this annotation

GitHub Actions / Build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 15 in tests/Serval.Translation.Tests/Services/PlatformServiceTests.cs

View workflow job for this annotation

GitHub Actions / Build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

[Test]
public async Task IncrementCorpusSizeAsync() { }

Check warning on line 18 in tests/Serval.Translation.Tests/Services/PlatformServiceTests.cs

View workflow job for this annotation

GitHub Actions / Build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 18 in tests/Serval.Translation.Tests/Services/PlatformServiceTests.cs

View workflow job for this annotation

GitHub Actions / Build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

private class TestEnvironment
{
public TestEnvironment()
{
Builds = new MemoryRepository<Build>();
Engines = new MemoryRepository<Engine>();
Pretranslations = new MemoryRepository<Pretranslation>();
DataAccessContext = Substitute.For<IDataAccessContext>();
PublishEndpoint = Substitute.For<IPublishEndpoint>();
ServerCallContext = Substitute.For<ServerCallContext>();
}

public IRepository<Build> Builds { get; }
public IRepository<Engine> Engines { get; }
public IRepository<Pretranslation> Pretranslations { get; }
public IDataAccessContext DataAccessContext { get; }
public IPublishEndpoint PublishEndpoint { get; }
public ServerCallContext ServerCallContext { get; }
}
}

0 comments on commit 963766e

Please sign in to comment.