Ejemplo n.º 1
0
        public void CheckBaseSearch()
        {
            string                   query = TestContext.Parameters["basicQuery"];
            ADOSSearchHandler        se    = new ADOSSearchHandler(_client);
            MessagingExtensionResult me    = se.GetSearchResultAsync(query).Result;

            Assert.Pass();
        }
Ejemplo n.º 2
0
        public void CheckEpicIcon()
        {
            string                   query = TestContext.Parameters["epicId"];
            ADOSSearchHandler        se    = new ADOSSearchHandler(_client);
            MessagingExtensionResult me    = se.GetSearchResultAsync(query).Result;

            Assert.AreEqual("image/jpeg;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNDQ4Ij48cGF0aCBkPSJNNDQ4IDk2YzAgMTcuNjcyLTE0LjMyNiAzMi0zMiAzMnYyODhIMzJWMTI4Yy0xNy42NzQgMC0zMi0xNC4zMjgtMzItMzIgMC0xNy42NzQgMTQuMzI2LTMyIDMyLTMyczMyIDE0LjMyNiAzMiAzMmMwIDExLjE5MS02LjA5NCAyMC41NjQtMTQuNzk3IDI2LjI4M0wxMzYuNzI3IDI1NiAyMTYuNzkgOTQuNTQzQzIwMi42OTkgOTEuMTkxIDE5MiA3OS4xMTMgMTkyIDY0YzAtMTcuNjc0IDE0LjMyNi0zMiAzMi0zMnMzMiAxNC4zMjYgMzIgMzJjMCAxNS4xMTMtMTAuNjk5IDI3LjE5MS0yNC43ODkgMzAuNTQzTDMxMS4yNzMgMjU2bDg3LjUyMy0xMzMuNzE3QzM5MC4wOTQgMTE2LjU2NCAzODQgMTA3LjE5MSAzODQgOTZjMC0xNy42NzQgMTQuMzI2LTMyIDMyLTMyczMyIDE0LjMyNiAzMiAzMnoiIGZpbGw9IiNmZjdiMDAiIC8+PC9zdmc+", ((ThumbnailCard)me.Attachments[0].Content).Images[0].Url);
        }
Ejemplo n.º 3
0
        public async Task OnTurnAsync(ITurnContext turnCtx, CancellationToken cancellationToken)
        {
            try
            {
                if (turnCtx.Activity != null && turnCtx.Activity.Type != null && turnCtx.Activity.Type == ActivityTypes.Invoke)
                {
                    ITeamsContext teamsContext = turnCtx.TurnState.Get <ITeamsContext>();

                    MessagingExtensionQuery meQuery = null;
                    if (teamsContext.IsRequestMessagingExtensionQuery())
                    {
                        meQuery = teamsContext.GetMessagingExtensionQueryData();
                    }

                    InvokeResponse ir = new InvokeResponse
                    {
                        Body = new MessagingExtensionResponse
                        {
                            ComposeExtension = await searchHandler.GetSearchResultAsync(meQuery.Parameters[0].Value.ToString())
                        },
                        Status = 200,
                    };

                    await turnCtx.SendActivityAsync(
                        new Activity
                    {
                        Value = ir,
                        Type  = ActivityTypesEx.InvokeResponse,
                    }).ConfigureAwait(false);
                }
                else
                {
                    await turnCtx.SendActivityAsync(string.Format("Sorry! As of now I'm only support an invoke command, but you're trying to execute {0}", (turnCtx.Activity != null && turnCtx.Activity.Type != null) ? turnCtx.Activity.Type.ToString() : "empty activity"));
                }
            }
            catch (Exception ex)
            {
                await turnCtx.SendActivityAsync($"Oppps, seems like an error: {ex.InnerException}. Try again or contact your IT admin");
            }
        }