コード例 #1
0
        public async Task TestAdapter_GetTokenStatusWithFilter()
        {
            TestAdapter adapter   = new TestAdapter();
            string      channelId = "directline";
            string      userId    = "testUser";
            string      token     = "abc123";
            Activity    activity  = new Activity()
            {
                ChannelId = channelId,
                From      = new ChannelAccount()
                {
                    Id = userId,
                },
            };
            TurnContext turnContext = new TurnContext(adapter, activity);

            adapter.AddUserToken("ABC", channelId, userId, token);
            adapter.AddUserToken("DEF", channelId, userId, token);

            var status = await adapter.GetTokenStatusAsync(turnContext, userId, "DEF");

            Assert.NotNull(status);
            Assert.Single(status);

            var oAuthAppCredentials = MicrosoftAppCredentials.Empty;

            status = await adapter.GetTokenStatusAsync(turnContext, oAuthAppCredentials, userId, "DEF");

            Assert.NotNull(status);
            Assert.Single(status);
        }
コード例 #2
0
        public async Task TestAdapter_GetTokenStatusWithFilter()
        {
            TestAdapter adapter   = new TestAdapter();
            string      channelId = "directline";
            string      userId    = "testUser";
            string      token     = "abc123";
            Activity    activity  = new Activity()
            {
                ChannelId = channelId,
                From      = new ChannelAccount()
                {
                    Id = userId,
                },
            };
            TurnContext turnContext = new TurnContext(adapter, activity);

            adapter.AddUserToken("ABC", channelId, userId, token);
            adapter.AddUserToken("DEF", channelId, userId, token);

            var status = await adapter.GetTokenStatusAsync(turnContext, userId, "DEF");

            Assert.IsNotNull(status);
            Assert.AreEqual(1, status.Length);
        }