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))); }
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"); }