예제 #1
0
        public async Task HallOfFameGivesValidResponseForEveryLanguage()
        {
            var allLanguages = Enum.GetValues(typeof(Language)).Cast <Language>();

            foreach (var language in allLanguages)
            {
                var server = await m_serverLocator.SearchAsync(language, ServerType.Person).ConfigureAwait(false);

                using IAkinatorClient client = new AkinatorClient(server);
                var result = await client.GetHallOfFame();

                Assert.IsNotNull(result);
                Assert.AreNotEqual(0, result.Length);
            }
        }
예제 #2
0
        public async Task GetHallOfFameThrowsExceptionOnCancelled()
        {
            var server = await m_serverLocator.SearchAsync(Language.English, ServerType.Person).ConfigureAwait(false);

            using (IAkinatorClient client = new AkinatorClient(server))
            {
                var src = new CancellationTokenSource();
                var cancellationToken = src.Token;
                src.Cancel();

                await client.GetHallOfFame(cancellationToken);
            }

            Assert.Fail("No exception was thrown");
        }