-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
54 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
backend/FwLite/FwLiteProjectSync.Tests/Fixtures/TestingKernel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using FwDataMiniLcmBridge; | ||
using FwDataMiniLcmBridge.Tests.Fixtures; | ||
using LcmCrdt; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace FwLiteProjectSync.Tests.Fixtures; | ||
|
||
public static class TestingKernel | ||
{ | ||
public static IServiceCollection AddSyncServices(this IServiceCollection services, string projectName, bool mockFwProjectLoader = true) | ||
{ | ||
return services.AddLcmCrdtClient() | ||
.AddTestFwDataBridge(mockFwProjectLoader) | ||
.AddFwLiteProjectSync() | ||
.AddSingleton<ProjectContext>(new MockProjectContext(null)) | ||
.Configure<FwDataBridgeConfig>(c => c.ProjectsFolder = Path.Combine(".", projectName, "FwData")) | ||
.Configure<LcmCrdtConfig>(c => c.ProjectPath = Path.Combine(".", projectName, "LcmCrdt")) | ||
.AddLogging(builder => builder.AddDebug()); | ||
} | ||
|
||
public class MockProjectContext(CrdtProject? project) : ProjectContext | ||
{ | ||
public override CrdtProject? Project { get; set; } = project; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters