private async Task <HandoffRequest> GetHandoffRequestAsync(HttpMessageHandler messageHandler, string testValue) { var adapter = new BotFrameworkHttpAdapterWithHandoff(); var turnContext = new TurnContext(adapter, new Activity { Conversation = new ConversationAccount { Id = "123" } }); //var mockClient = new MockConnectorClient(); var mockHttpClient = new HttpClient(messageHandler); var mockClient = new Mock <IConnectorClient>(); mockClient.Setup(c => c.Conversations).Returns(new MockConversations(mockHttpClient)); //var connector = new MockConnector(mockHttpClient); //var connector = new Mock<ConnectorClient>(mockHttpClient); //var mockConversations = new Mock<IServiceOperations<ConnectorClient>>(); //mockConversations.Setup(c => c.Client).Returns(connector); //mockClient.Conversations = new MockConversations(mockHttpClient); turnContext.TurnState.Add <IConnectorClient>(mockClient.Object); var activity = new Activity() as IActivity; var handoffRequest = await turnContext.InitiateHandoffAsync(new IActivity[] { activity }, new { TestObject = testValue }); return(handoffRequest); }
public async Task BotFrameworkHttpAdapter_does_not_support_handoff() { await Assert.ThrowsExceptionAsync <NotSupportedException>(async() => { var adapter = new BotFrameworkHttpAdapter(); ITurnContext turnContext = new TurnContext(adapter, new Schema.Activity()); await turnContext.InitiateHandoffAsync(new IActivity [] { }, 0); }); }