Skip to content

Commit

Permalink
GH-224: Remove range check for calendar days
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikfroehling committed Mar 15, 2021
1 parent cb7d748 commit fa8f999
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 173 deletions.
2 changes: 0 additions & 2 deletions Source/Lib/Trakt.NET/Requests/Calendars/ACalendarRequest'1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public override IDictionary<string, object> GetUriPathParameters()

public override void Validate()
{
if (Days.HasValue && (Days.Value < 1 || Days.Value > 31))
throw new ArgumentOutOfRangeException(nameof(Days), "days must have a value between 1 and 31");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetAllDVDMovies_Throws_API_Exception(
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetAllDVDMovies_ArgumentExceptions()
{
TraktClient client = TestUtility.GetMockClient(GET_ALL_DVD_MOVIES_URI,
CALENDAR_DVD_MOVIES_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarMovie>>> act = () => client.Calendar.GetAllDVDMoviesAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetAllDVDMoviesAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetAllMovies_Throws_API_Exception(Htt
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetAllMovies_ArgumentExceptions()
{
TraktClient client = TestUtility.GetMockClient(GET_ALL_MOVIES_URI,
CALENDAR_ALL_MOVIES_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarMovie>>> act = () => client.Calendar.GetAllMoviesAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetAllMoviesAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetAllNewShows_Throws_API_Exception(H
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetAllNewShows_ArgumentExceptions()
{
TraktClient client = TestUtility.GetMockClient($"{GET_ALL_NEW_SHOWS_URI}",
CALENDAR_ALL_SHOWS_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarShow>>> act = () => client.Calendar.GetAllNewShowsAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetAllNewShowsAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetAllSeasonPremieres_Throws_API_Exce
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetAllSeasonPremieres_ArgumentExceptions()
{
TraktClient client = TestUtility.GetMockClient(GET_ALL_SEASON_PREMIERES_URI,
CALENDAR_ALL_SHOWS_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarShow>>> act = () => client.Calendar.GetAllSeasonPremieresAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetAllSeasonPremieresAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetAllShows_Throws_API_Exception(Http
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetAllShows_ArgumentExceptions()
{
TraktClient client = TestUtility.GetMockClient(GET_ALL_SHOWS_URI,
CALENDAR_ALL_SHOWS_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarShow>>> act = () => client.Calendar.GetAllShowsAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetAllShowsAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetUserDVDMovies_Throws_API_Exception
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetUserDVDMovies_ArgumentExceptions()
{
TraktClient client = TestUtility.GetOAuthMockClient(GET_USER_DVD_MOVIES_URI,
CALENDAR_DVD_MOVIES_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarMovie>>> act = () => client.Calendar.GetUserDVDMoviesAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetUserDVDMoviesAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetUserMovies_Throws_API_Exception(Ht
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetUserMovies_ArgumentExceptions()
{
TraktClient client = TestUtility.GetOAuthMockClient(GET_USER_MOVIES_URI,
CALENDAR_ALL_MOVIES_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarMovie>>> act = () => client.Calendar.GetUserMoviesAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetUserMoviesAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetUserNewShows_Throws_API_Exception(
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetUserNewShows_ArgumentExceptions()
{
TraktClient client = TestUtility.GetOAuthMockClient(GET_USER_NEW_SHOWS_URI,
CALENDAR_ALL_SHOWS_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarShow>>> act = () => client.Calendar.GetUserNewShowsAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetUserNewShowsAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetUserSeasonPremieres_Throws_API_Exc
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetUserSeasonPremieres_ArgumentExceptions()
{
TraktClient client = TestUtility.GetOAuthMockClient(GET_USER_SEASON_PREMIERES_URI,
CALENDAR_ALL_SHOWS_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarShow>>> act = () => client.Calendar.GetUserSeasonPremieresAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetUserSeasonPremieresAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,5 @@ public async Task Test_TraktCalendarModule_GetUserShows_Throws_API_Exception(Htt
(exception.GetType() == exceptionType).Should().BeTrue();
}
}

[Fact]
public void Test_TraktCalendarModule_GetUserShows_ArgumentExceptions()
{
TraktClient client = TestUtility.GetOAuthMockClient(GET_USER_SHOWS_URI,
CALENDAR_ALL_SHOWS_JSON,
startDate: START_DATE, endDate: END_DATE);

Func<Task<TraktListResponse<ITraktCalendarShow>>> act = () => client.Calendar.GetUserShowsAsync(null, 0);
act.Should().Throw<ArgumentOutOfRangeException>();

act = () => client.Calendar.GetUserShowsAsync(null, 32);
act.Should().Throw<ArgumentOutOfRangeException>();
}
}
}

This file was deleted.

0 comments on commit fa8f999

Please sign in to comment.