-
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.
Reworked projectType to projectInterfaces, reworked ParatextStandard …
…file system format to match Paratext 9 (#918)
- Loading branch information
Showing
76 changed files
with
3,409 additions
and
1,566 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Text.Json.Nodes; | ||
using Paranext.DataProvider.MessageHandlers; | ||
using Paranext.DataProvider.MessageTransports; | ||
using Paranext.DataProvider.NetworkObjects; | ||
using Paranext.DataProvider.Services; | ||
|
||
namespace TestParanextDataProvider; | ||
|
||
[ExcludeFromCodeCoverage] | ||
internal class DummySettingsService : DataProvider | ||
{ | ||
private readonly Dictionary<string, object> _settingValues = []; | ||
private readonly List<string> _supportedFunctions = ["get"]; | ||
|
||
public DummySettingsService(PapiClient papiClient) | ||
: base(SettingsService.SETTINGS_SERVICE_NAME, papiClient) { } | ||
|
||
public void AddSettingValue(string key, object value) | ||
{ | ||
_settingValues.Add(key, value); | ||
} | ||
|
||
public void ClearSettingValues() | ||
{ | ||
_settingValues.Clear(); | ||
} | ||
|
||
protected override Task StartDataProvider() | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
protected override List<string> GetFunctionNames() | ||
{ | ||
return _supportedFunctions; | ||
} | ||
|
||
protected override ResponseToRequest HandleRequest(string functionName, JsonArray args) | ||
{ | ||
return functionName switch | ||
{ | ||
"get" | ||
=> _settingValues.ContainsKey(args[0]!.ToString()) | ||
? ResponseToRequest.Succeeded(_settingValues[args[0]!.ToString()]) | ||
: ResponseToRequest.Failed($"Could not find value for setting {args[0]}"), | ||
_ => ResponseToRequest.Failed($"Unexpected function: {functionName}") | ||
}; | ||
} | ||
} |
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
Oops, something went wrong.