Beispiel #1
0
        public async Task ReuseSessionWorks()
        {
            AkinatorUserSession userSessionFromFirstClient;

            var server = await m_serverLocator.SearchAsync(Language.English, ServerType.Person).ConfigureAwait(false);

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

                Assert.AreEqual(0, question.Step);

                question = await client.Answer(AnswerOptions.Yes);

                Assert.AreEqual(1, question.Step);

                userSessionFromFirstClient = client.GetUserSession();
            }

            using (IAkinatorClient newClient = new AkinatorClient(server, userSessionFromFirstClient))
            {
                var question = await newClient.Answer(AnswerOptions.Yes);

                Assert.AreEqual(2, question.Step);
            }
        }
        public async Task ReuseSessionWorks()
        {
            AkinatorUserSession userSessionFromFirstClient;

            using (IAkinatorClient client = new AkinatorClient(Language.English, ServerType.Person))
            {
                var question = await client.StartNewGame();

                Assert.AreEqual(0, question.Step);

                question = await client.Answer(AnswerOptions.Yes);

                Assert.AreEqual(1, question.Step);

                userSessionFromFirstClient = client.GetUserSession();
            }

            using (IAkinatorClient newClient = new AkinatorClient(Language.English, ServerType.Person, userSessionFromFirstClient))
            {
                var question = await newClient.Answer(AnswerOptions.Yes);

                Assert.AreEqual(2, question.Step);
            }
        }