mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
rm unnecessary ext method
This commit is contained in:
parent
220803ec40
commit
a50519cf1a
6 changed files with 5 additions and 50 deletions
|
|
@ -6,7 +6,7 @@ namespace FilterLists.Agent.Core.GitHub
|
|||
{
|
||||
public interface IIssuesRepository
|
||||
{
|
||||
Task<IReadOnlyList<Issue>> GetAllIssuesAsync(RepositoryIssueRequest repositoryIssueRequest);
|
||||
Task<IEnumerable<Issue>> GetAllIssuesAsync(RepositoryIssueRequest repositoryIssueRequest);
|
||||
|
||||
Task<Issue> CreateIssueAsync(NewIssue newIssue);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace FilterLists.Agent.Extensions
|
||||
{
|
||||
public static class ReadOnlyListExtensions
|
||||
{
|
||||
public static T FirstOrDefault<T>(this IReadOnlyList<T> list)
|
||||
{
|
||||
return list.Count == 0 ? default! : list[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Threading;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Agent.Core.GitHub;
|
||||
using FilterLists.Agent.Extensions;
|
||||
using MediatR;
|
||||
using Octokit;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FilterLists.Agent.Core.GitHub;
|
||||
using FilterLists.Agent.Core.Urls;
|
||||
using FilterLists.Agent.Extensions;
|
||||
using MediatR;
|
||||
using Octokit;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public IssuesRepository(IGitHubClient gitHubClient, IOptions<GitHubSettings> git
|
|||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<Issue>> GetAllIssuesAsync(RepositoryIssueRequest repositoryIssueRequest)
|
||||
public async Task<IEnumerable<Issue>> GetAllIssuesAsync(RepositoryIssueRequest repositoryIssueRequest)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using FilterLists.Agent.Extensions;
|
||||
using Xunit;
|
||||
|
||||
namespace FilterLists.Agent.Tests.Extensions
|
||||
{
|
||||
public class ReadOnlyListExtensionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void FirstOrDefault_WithEmptyList_ReturnsDefault()
|
||||
{
|
||||
var list = (IReadOnlyList<int>)new List<int>();
|
||||
var sut = list.FirstOrDefault();
|
||||
Assert.Equal(default, sut);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FirstOrDefault_WithOneListElement_ReturnsFirstListElement()
|
||||
{
|
||||
var list = (IReadOnlyList<int>)new List<int> {0};
|
||||
var sut = list.FirstOrDefault();
|
||||
Assert.Equal(0, sut);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FirstOrDefault_WithMoreThanOneListElement_ReturnsFirstListElement()
|
||||
{
|
||||
var list = (IReadOnlyList<int>)new List<int> {1, 2, 3};
|
||||
var sut = list.FirstOrDefault();
|
||||
Assert.Equal(1, sut);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue