Skip to content

Commit

Permalink
Adjusted tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ervie committed Mar 17, 2019
1 parent 24f5f77 commit f23216f
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 8 deletions.
8 changes: 5 additions & 3 deletions JikanDotNet/JikanDotNet.Test/OtherTestsClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ public void ShouldParseCacheExpiration()

if (!request.RequestCached)
{
request = Task.Run(() => jikan.GetAnime(randomId)).Result;
Assert.Equal(43200, request.RequestCacheExpiry);
}
else
{
Assert.True(request.RequestCacheExpiry < 43200);
}

Assert.True(request.RequestCached);
}
}
}
37 changes: 33 additions & 4 deletions JikanDotNet/JikanDotNet.Test/SearchTestClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public void ShouldReturnNoResult()
var nullPerson = Task.Run(() => jikan.SearchPerson("")).Result;
var nullCharacter = Task.Run(() => jikan.SearchCharacter("")).Result;

Assert.Null(nullAnime);
Assert.Null(nullManga);
Assert.Null(nullPerson);
Assert.Null(nullCharacter);
Assert.Empty(nullAnime.Results);
Assert.Empty(nullManga.Results);
Assert.Empty(nullPerson.Results);
Assert.Empty(nullCharacter.Results);
}

[Theory]
Expand All @@ -46,6 +46,19 @@ public void ShouldReturnDanganronpaAnime()
Assert.Equal(20, danganronpaAnime.ResultLastPage);
}

[Fact]
public void ShouldReturnAiringOnePieceAnime()
{
AnimeSearchConfig searchConfig = new AnimeSearchConfig()
{
Status = AiringStatus.Airing
};

AnimeSearchResult onePieceAnime = Task.Run(() => jikan.SearchAnime("one", searchConfig)).Result;

Assert.Equal("One Piece", onePieceAnime.Results.First().Title);
}

[Fact]
public void ShouldReturnHaibaneRenmeiAnime()
{
Expand Down Expand Up @@ -95,6 +108,22 @@ public void ShouldReturnYotsubatoManga()
Assert.Equal(104, yotsubato.Results.First().MalId);
}

[Fact]
public void ShouldReturnPublishedYotsubatoManga()
{
MangaSearchConfig searchConfig = new MangaSearchConfig()
{
Status = AiringStatus.Airing
};

MangaSearchResult yotsubato = Task.Run(() => jikan.SearchManga("yotsubato", searchConfig)).Result;

Assert.Equal("Yotsuba to!", yotsubato.Results.First().Title);
Assert.Equal("Manga", yotsubato.Results.First().Type);
Assert.Equal(0, yotsubato.Results.First().Volumes);
Assert.Equal(104, yotsubato.Results.First().MalId);
}

[Fact]
public void ShouldFindGirlManga()
{
Expand Down
2 changes: 1 addition & 1 deletion JikanDotNet/JikanDotNet.Test/SeasonTestClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void ShouldParseWinter2000()
{
Season winter2000 = Task.Run(() => jikan.GetSeason(2000, Seasons.Winter)).Result;

Assert.Contains("Boogiepop wa Warawanai: Boogiepop Phantom", winter2000.SeasonEntries.Select(x => x.Title));
Assert.Contains("Boogiepop wa Warawanai", winter2000.SeasonEntries.Select(x => x.Title));
Assert.Contains("Ojamajo Doremi Sharp", winter2000.SeasonEntries.Select(x => x.Title));
}

Expand Down
21 changes: 21 additions & 0 deletions JikanDotNet/JikanDotNet.Test/UserTestClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ public void ShouldParseErvelanAnimeList()
Assert.Contains("Akira", animeList.Anime.Select(x => x.Title));
}

[Fact]
public void ShouldParseErvelanMangaWatchingList()
{
UserAnimeList animeList = Task.Run(() => jikan.GetUserAnimeList("Ervelan", UserAnimeListExtension.Watching)).Result;

Assert.NotNull(animeList);
Assert.Equal(UserAnimeListExtension.Watching, animeList.Anime.First().WatchingStatus);
Assert.Equal(AiringStatus.Airing, animeList.Anime.First().AiringStatus);
}

[Fact]
public void ShouldParseErvelanDroppedList()
{
Expand Down Expand Up @@ -125,6 +135,17 @@ public void ShouldParseErvelanMangaList()
Assert.Contains("Dr. Stone", mangaList.Manga.Select(x => x.Title));
}

[Fact]
public void ShouldParseErvelanMangaReadingList()
{
UserMangaList mangaList = Task.Run(() => jikan.GetUserMangaList("Ervelan", UserMangaListExtension.Reading)).Result;

Assert.NotNull(mangaList);
Assert.Contains("One Piece", mangaList.Manga.Select(x => x.Title));
Assert.Equal(UserMangaListExtension.Reading, mangaList.Manga.First().ReadingStatus);
Assert.Equal(AiringStatus.Airing, mangaList.Manga.First().PublishingStatus);
}

[Fact]
public void ShouldParseErvelanMangaDroppedList()
{
Expand Down

0 comments on commit f23216f

Please sign in to comment.