public async Task DeleteTicketTaskModuleSubmitUserInputCard() { var sp = Services.BuildServiceProvider(); var adapter = sp.GetService <TestAdapter>(); var conversationState = sp.GetService <ConversationState>(); var stateAccessor = conversationState.CreateProperty <SkillState>(nameof(SkillState)); var skillState = new SkillState(); skillState.AccessTokenResponse = new TokenResponse { Token = "Test" }; // TaskModule Activity For Submit var taskSubmit = "{\r\n \"data\": {\r\n \"msteams\": {\r\n \"type\": \"task /fetch\"\r\n },\r\n \"data\": {\r\n \"TaskModuleFlowType\": \"DeleteTicket_Form\",\r\n \"FlowData\": {\r\n \"IncidentId\": \"MockCreateTicketId\"\r\n },\r\n \"Submit\": true\r\n },\r\n \"IncidentCloseReason\": \"Test\"\r\n },\r\n \"context\": {\r\n \"theme\": \"dark\"\r\n }\r\n}"; var activity = new Activity { ChannelId = "test", Conversation = new ConversationAccount { Id = "Test" }, Type = ActivityTypes.Invoke, Name = "task/fetch", Value = JObject.Parse(taskSubmit) }; var turnContext = new TurnContext(adapter, activity); await stateAccessor.SetAsync(turnContext, skillState, CancellationToken.None); var teamsImplementation = new DeleteTicketTeamsImplementation(sp); TaskModuleContinueResponse response = await teamsImplementation.OnTeamsTaskModuleSubmitAsync(turnContext, CancellationToken.None); Assert.IsNotNull(response); Assert.AreEqual("Incident Deleted", response.Value.Title); var attachment = response.Value.Card; Assert.IsNotNull(attachment); var adaptiveCard = (AdaptiveCard)attachment.Content; Assert.IsNotNull(adaptiveCard); Assert.AreEqual(adaptiveCard.Id, "IncidentResponseCard"); // TODO: Add more validation steps on AdaptiveCard }
public async Task DeleteTicketTaskModuleGetUserInputCard() { var sp = Services.BuildServiceProvider(); var adapter = sp.GetService <TestAdapter>(); adapter.AddUserToken(AuthenticationProvider, adapter.Conversation.ChannelId, adapter.Conversation.User.Id, TestToken, MagicCode); // TaskModule Activity For Fetch var taskFetch = "{\r\n \"data\": {\r\n \"data\": {\r\n \"TaskModuleFlowType\": \"DeleteTicket_Form\",\r\n \"FlowData\": {\r\n \"IncidentId\": \"120874\"\r\n },\r\n \"Submit\": true\r\n },\r\n \"type\": \"task / fetch\"\r\n },\r\n \"context\": {\r\n \"theme\": \"dark\"\r\n }\r\n}"; var activity = new Activity { Type = ActivityTypes.Invoke, Name = "task/fetch", Value = JObject.Parse(taskFetch), ChannelId = "msteams" }; var turnContext = new TurnContext(adapter, activity); var teamsImplementation = new DeleteTicketTeamsImplementation(sp); TaskModuleContinueResponse response = await teamsImplementation.OnTeamsTaskModuleFetchAsync(turnContext, CancellationToken.None); Assert.IsNotNull(response); Assert.AreEqual("DeleteIncident", response.Value.Title); var attachment = response.Value.Card; Assert.IsNotNull(attachment); var adaptiveCard = (AdaptiveCard)attachment.Content; Assert.IsNotNull(adaptiveCard); Assert.AreEqual(adaptiveCard.Id, "DeleteTicketAdaptiveCard"); // TODO: Add more validation steps on AdaptiveCard }