PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/MalApi.Tests/AnimeListCacheTests.cs

https://bitbucket.org/LHCGreg/mal-api
C# | 43 lines | 25 code | 3 blank | 15 comment | 0 complexity | f5ea59e2544362ee1b7b8b1dc82c0474 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. using MalApi;
  7. using System.Threading;
  8. namespace MalApi.Tests
  9. {
  10. [TestFixture]
  11. public class AnimeListCacheTests
  12. {
  13. [Test]
  14. public void TestCacheCaseInsensitivity()
  15. {
  16. using (AnimeListCache cache = new AnimeListCache(expiration: TimeSpan.FromHours(5)))
  17. {
  18. cache.PutListForUser("a", new MalUserLookupResults(userId: 5, canonicalUserName: "A", animeList: new List<MyAnimeListEntry>()));
  19. MalUserLookupResults lookup;
  20. cache.GetListForUser("A", out lookup);
  21. Assert.That(lookup.UserId, Is.EqualTo(5));
  22. }
  23. }
  24. }
  25. }
  26. /*
  27. Copyright 2012 Greg Najda
  28. Licensed under the Apache License, Version 2.0 (the "License");
  29. you may not use this file except in compliance with the License.
  30. You may obtain a copy of the License at
  31. http://www.apache.org/licenses/LICENSE-2.0
  32. Unless required by applicable law or agreed to in writing, software
  33. distributed under the License is distributed on an "AS IS" BASIS,
  34. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  35. See the License for the specific language governing permissions and
  36. limitations under the License.
  37. */