public async Task TeamsSendToGeneralChannelAsync() { // Arrange var destinationConversationAccountId = string.Empty; void CaptureSend(Activity[] arg) { destinationConversationAccountId = arg[0].Conversation.Id; } var inboundActivity = new Activity { Type = ActivityTypes.Message, Conversation = new ConversationAccount { Id = "originalId" }, ChannelData = new TeamsChannelData { Team = new TeamInfo { Id = "team123" } }, }; var turnContext = new TurnContext(new SimpleAdapter(CaptureSend), inboundActivity); // Act await turnContext.TeamsSendToGeneralChannelAsync(MessageFactory.Text("hi")); // Assert Assert.AreEqual("originalId", inboundActivity.Conversation.Id); Assert.AreEqual("team123", destinationConversationAccountId); }
public async Task TeamsSendToGeneralChannelAsync() { // Arrange var inboundActivity = new Activity { Type = ActivityTypes.Message, Conversation = new ConversationAccount { Id = "originalId" }, ChannelData = new TeamsChannelData { Team = new TeamInfo { Id = "team123" } }, }; var turnContext = new TurnContext(new SimpleAdapter((Activity[] arg) => { }), inboundActivity); var baseUri = new Uri("http://no-where"); var credentials = new MicrosoftAppCredentials(string.Empty, string.Empty); var messageHandler = new RecordingHttpMessageHandler(); turnContext.TurnState.Add <IConnectorClient>(new ConnectorClient(baseUri, credentials, new HttpClient(messageHandler))); // Act var(conversationReference, activityId) = await turnContext.TeamsSendToGeneralChannelAsync(MessageFactory.Text("hi")); // Assert Assert.AreEqual("ConversationId", conversationReference.Conversation.Id); Assert.AreEqual("ActivityId", activityId); }