PageRenderTime 55ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 1ms

/MalApi.Integration/GetAnimeDetailsTest.cs

https://bitbucket.org/LHCGreg/mal-api
C# | 58 lines | 40 code | 3 blank | 15 comment | 0 complexity | 9aaae9007cf8c36c96e50e8a25a21d85 MD5 | raw file
Possible License(s): Apache-2.0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using NUnit.Framework;
  6. namespace MalApi.Integration
  7. {
  8. [TestFixture]
  9. public class GetAnimeDetailsTest
  10. {
  11. [Test]
  12. public void GetAnimeDetails()
  13. {
  14. int animeId = 237; // Eureka Seven
  15. using (MyAnimeListApi api = new MyAnimeListApi())
  16. {
  17. AnimeDetailsResults results = api.GetAnimeDetails(animeId);
  18. List<Genre> expectedGenres = new List<Genre>()
  19. {
  20. new Genre(2, "Adventure"),
  21. new Genre(8, "Drama"),
  22. new Genre(18, "Mecha"),
  23. new Genre(22, "Romance"),
  24. new Genre(24, "Sci-Fi"),
  25. new Genre(27, "Shounen")
  26. };
  27. Assert.That(results.Genres, Is.EquivalentTo(expectedGenres));
  28. }
  29. }
  30. [Test]
  31. public void GetAnimeDetailsForInvalidAnimeId()
  32. {
  33. int animeId = 99999;
  34. using (MyAnimeListApi api = new MyAnimeListApi())
  35. {
  36. Assert.Throws<MalAnimeNotFoundException>(() => api.GetAnimeDetails(animeId));
  37. }
  38. }
  39. }
  40. }
  41. /*
  42. Copyright 2012 Greg Najda
  43. Licensed under the Apache License, Version 2.0 (the "License");
  44. you may not use this file except in compliance with the License.
  45. You may obtain a copy of the License at
  46. http://www.apache.org/licenses/LICENSE-2.0
  47. Unless required by applicable law or agreed to in writing, software
  48. distributed under the License is distributed on an "AS IS" BASIS,
  49. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  50. See the License for the specific language governing permissions and
  51. limitations under the License.
  52. */