예제 #1
0
        public async Task SearchCharacter_ReturnsValidCharactersForASearchTerm()
        {
            var server = await m_serverLocator.SearchAsync(Language.English, ServerType.Person).ConfigureAwait(false);

            using IAkinatorClient client = new AkinatorClient(server);
            await client.StartNewGame();

            var chars = await client.SearchCharacter("Brat Pitt");

            Assert.IsTrue(chars.Any(p => p.Name.Contains("brat pitt", StringComparison.InvariantCultureIgnoreCase)));
        }
예제 #2
0
        public async Task SearchCharacterThrowsExceptionOnCancelled()
        {
            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.SearchCharacter("Brat Pitt", cancellationToken);
            }

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