Esempio n. 1
0
 public void GetAnimeListForNonexistentUserThrowsCorrectExceptionAsync()
 {
     using (MyAnimeListApi api = new MyAnimeListApi())
     {
         Assert.ThrowsAsync <MalUserNotFoundException>(() => api.GetAnimeListForUserAsync("oijsfjisfdjfsdojpfsdp"));
     }
 }
Esempio n. 2
0
        public void GetAnimeListForUserCanceled()
        {
            string username = "******";

            using (MyAnimeListApi api = new MyAnimeListApi())
            {
                CancellationTokenSource     tokenSource    = new CancellationTokenSource();
                Task <MalUserLookupResults> userLookupTask = api.GetAnimeListForUserAsync(username, tokenSource.Token);
                tokenSource.Cancel();
                Assert.Throws <TaskCanceledException>(() => userLookupTask.GetAwaiter().GetResult());
            }
        }