テスト用にプロバイダ注入シームを追加
このコミットが含まれているのは:
2ファイル変更
+16
-3
検索条件に一致するファイルはありません
@@ -7,6 +7,11 @@ public sealed class GitHubUpdateNotifier
|
||||
private readonly ReleaseResolver _resolver;
|
||||
|
||||
public GitHubUpdateNotifier(string owner, string repository, UpdateNotifierOptions options)
|
||||
: this(owner, repository, options, DefaultProviders())
|
||||
{
|
||||
}
|
||||
|
||||
internal GitHubUpdateNotifier(string owner, string repository, UpdateNotifierOptions options, IReadOnlyList<IReleaseProvider> providers)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(owner);
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(repository);
|
||||
@@ -14,12 +19,11 @@ public sealed class GitHubUpdateNotifier
|
||||
ArgumentNullException.ThrowIfNull(options.CurrentVersion);
|
||||
ArgumentNullException.ThrowIfNull(options.MessageFormatter);
|
||||
ArgumentNullException.ThrowIfNull(options.NotificationHandler);
|
||||
ArgumentNullException.ThrowIfNull(providers);
|
||||
|
||||
_repository = new RepositoryReference(owner, repository);
|
||||
_options = options;
|
||||
_resolver = new ReleaseResolver(
|
||||
[new ManjuboxReleaseProvider(), new GitHubReleaseProvider()],
|
||||
Math.Max(0, options.RetryCount));
|
||||
_resolver = new ReleaseResolver(providers, Math.Max(0, options.RetryCount));
|
||||
}
|
||||
|
||||
public async Task<UpdateCheckResult> CheckAsync(CancellationToken cancellationToken = default)
|
||||
@@ -53,4 +57,7 @@ public sealed class GitHubUpdateNotifier
|
||||
await _options.NotificationHandler(new UpdateNotification(result.Update!, message), cancellationToken).ConfigureAwait(false);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static IReadOnlyList<IReleaseProvider> DefaultProviders()
|
||||
=> [new ManjuboxReleaseProvider(), new GitHubReleaseProvider()];
|
||||
}
|
||||
@@ -15,4 +15,10 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
|
||||
<_Parameter1>GitHubUpdateNotifier.Tests</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
新しいイシューから参照
ユーザーをブロックする