Ejemplo n.º 1
0
 private static void SetConversationDataWithHttpMessagesAsync(MockConnectorFactory mockConnectorFactory, Mock <StateClient> botsClient)
 {
     botsClient
     .Setup(d => d.BotState.SetConversationDataWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <BotData>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>()))
     .Returns <string, string, BotData, Dictionary <string, List <string> >, CancellationToken>(async(channelId, conversationId, data, headers, token) =>
     {
         return(await mockConnectorFactory.UpdateAndInsertData(channelId, null, conversationId, BotStoreType.BotConversationData, data));
     });
 }
Ejemplo n.º 2
0
 private static void GetUserDataWithHttpMessagesAsync(MockConnectorFactory mockConnectorFactory, Mock <StateClient> botsClient)
 {
     botsClient
     .Setup(d => d.BotState.GetUserDataWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>()))
     .Returns <string, string, Dictionary <string, List <string> >, CancellationToken>(async(channelId, userId, headers, token) =>
     {
         return(await mockConnectorFactory.GetData(channelId, userId, null, BotStoreType.BotUserData));
     });
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Mocks a Stateclient.
        /// </summary>
        /// <param name="mockConnectorFactory">A <see cref="MockConnectorFactory"/>.</param>
        /// <returns>A mocked version of StateClient.</returns>
        public static Mock <StateClient> MockIBots(MockConnectorFactory mockConnectorFactory)
        {
            var botsClient = new Mock <StateClient>(MockBehavior.Loose);

            SetConversationDataWithHttpMessagesAsync(mockConnectorFactory, botsClient);

            GetConversationDataWithHttpMessagesAsync(mockConnectorFactory, botsClient);

            SetUserDataWithHttpMessagesAsync(mockConnectorFactory, botsClient);

            GetUserDataWithHttpMessagesAsync(mockConnectorFactory, botsClient);

            SetPrivateConversationDataWithHttpMessagesAsync(mockConnectorFactory, botsClient);

            GetPrivateConversationDataWithHttpMessagesAsync(mockConnectorFactory, botsClient);

            return(botsClient);
        }