From de6cc438844bdc8d17ef3ba0aa5200dbee1c4fe4 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 13 Oct 2018 18:29:36 +0000 Subject: [PATCH] add GetCommitDatesAsyncShould test (#582) * add GetNthIndexOfCharShould tests * add GetCommitDatesAsyncShould test --- .../GitHub/GetCommitDatesAsyncShould.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/FilterLists.Services.Tests/GitHub/GetCommitDatesAsyncShould.cs diff --git a/tests/FilterLists.Services.Tests/GitHub/GetCommitDatesAsyncShould.cs b/tests/FilterLists.Services.Tests/GitHub/GetCommitDatesAsyncShould.cs new file mode 100644 index 000000000..e2b0bae23 --- /dev/null +++ b/tests/FilterLists.Services.Tests/GitHub/GetCommitDatesAsyncShould.cs @@ -0,0 +1,25 @@ +using System; +using System.Threading.Tasks; +using FilterLists.Services.GitHub; +using FilterLists.Services.GitHub.Models; +using Xunit; + +namespace FilterLists.Services.Tests.GitHub +{ + public class GetCommitDatesAsyncShould + { + [Fact] + public async Task ReturnCorrectCommitDatesForValidGitHubRawUrl() + { + const string rawFileUrl = "https://raw.githubusercontent.com/collinbarrett/FilterLists/master/LICENSE"; + var expectedCommitDates = new CommitDates + { + First = DateTime.Parse("2016-12-10T20:28:16.0000000"), + Last = DateTime.Parse("2018-01-24T00:08:21.0000000") + }; + var actualCommitDates = await new GitHubService().GetCommitDatesAsync(rawFileUrl); + Assert.Equal(expectedCommitDates.First, actualCommitDates.First); + Assert.Equal(expectedCommitDates.Last, actualCommitDates.Last); + } + } +} \ No newline at end of file