await certificate from ssl.com Reviewed-on: #4 Co-authored-by: Aleksandr Neychev <alexnejchev73@gmail.com>
This commit was merged in pull request #4.
This commit is contained in:
@@ -120,75 +120,6 @@ public sealed class FakeStartupService : IStartupService
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases the test writes itself, with no repository behind them.
|
||||
/// </summary>
|
||||
public sealed class FakeUpdateService : IUpdateService
|
||||
{
|
||||
public ReleaseInfo? Release { get; set; }
|
||||
|
||||
public Exception? Failure { get; set; }
|
||||
|
||||
public TaskCompletionSource? DownloadGate { get; set; }
|
||||
|
||||
public string PackagePath { get; set; } = string.Empty;
|
||||
|
||||
public int CheckCalls { get; private set; }
|
||||
|
||||
public List<string> Installed { get; } = [];
|
||||
|
||||
public bool IsSupported { get; set; } = true;
|
||||
|
||||
public Version CurrentVersion { get; set; } = new(1, 0, 0, 0);
|
||||
|
||||
public Task<ReleaseInfo?> CheckAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
CheckCalls++;
|
||||
|
||||
return Failure is null
|
||||
? Task.FromResult(Release)
|
||||
: Task.FromException<ReleaseInfo?>(Failure);
|
||||
}
|
||||
|
||||
public async Task<string> DownloadAsync(
|
||||
ReleaseInfo release,
|
||||
IProgress<double>? progress,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (DownloadGate is not null)
|
||||
{
|
||||
await DownloadGate.Task.WaitAsync(cancellationToken);
|
||||
}
|
||||
|
||||
if (Failure is not null)
|
||||
{
|
||||
throw Failure;
|
||||
}
|
||||
|
||||
progress?.Report(0.5);
|
||||
return PackagePath;
|
||||
}
|
||||
|
||||
public void Install(string packagePath) => Installed.Add(packagePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A release list the test fills in, with no repository behind it.
|
||||
/// </summary>
|
||||
public sealed class FakeReleaseFeed : IReleaseFeed
|
||||
{
|
||||
public ReleaseInfo? Release { get; set; }
|
||||
|
||||
public Exception? Failure { get; set; }
|
||||
|
||||
public List<HttpRequestMessage> Authorized { get; } = [];
|
||||
|
||||
public Task<ReleaseInfo?> GetLatestAsync(CancellationToken cancellationToken) =>
|
||||
Failure is null ? Task.FromResult(Release) : Task.FromException<ReleaseInfo?>(Failure);
|
||||
|
||||
public void Authorize(HttpRequestMessage request) => Authorized.Add(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interface strings without resources: the key comes back as is, tagged with the language.
|
||||
/// </summary>
|
||||
@@ -200,12 +131,20 @@ public sealed class FakeLocalizationService : ILocalizationService
|
||||
|
||||
public List<string> RequestedKeys { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Strings the test writes out in full — for the ones it puts values into.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> Strings { get; } = [];
|
||||
|
||||
public string this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
RequestedKeys.Add(key);
|
||||
return $"{_currentLanguage}:{key}";
|
||||
|
||||
return Strings.TryGetValue(key, out string? value)
|
||||
? value
|
||||
: $"{_currentLanguage}:{key}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user