public Mock <StateClient> MockIBots(MockConnectorFactory mockConnectorFactory) { var botsClient = new Moq.Mock <StateClient>(MockBehavior.Loose); 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.UpsertData(channelId, null, conversationId, BotStoreType.BotConversationData, data)); }); botsClient.Setup(d => d.BotState.GetConversationDataWithHttpMessagesAsync(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, conversationId, headers, token) => { return(await mockConnectorFactory.GetData(channelId, null, conversationId, BotStoreType.BotConversationData)); }); botsClient.Setup(d => d.BotState.SetUserDataWithHttpMessagesAsync(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, userId, data, headers, token) => { return(await mockConnectorFactory.UpsertData(channelId, userId, null, BotStoreType.BotUserData, data)); }); 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)); }); botsClient.Setup(d => d.BotState.SetPrivateConversationDataWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <BotData>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns <string, string, string, BotData, Dictionary <string, List <string> >, CancellationToken>(async(channelId, conversationId, userId, data, headers, token) => { return(await mockConnectorFactory.UpsertData(channelId, userId, conversationId, BotStoreType.BotPrivateConversationData, data)); }); botsClient.Setup(d => d.BotState.GetPrivateConversationDataWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns <string, string, string, Dictionary <string, List <string> >, CancellationToken>(async(channelId, conversationId, userId, headers, token) => { return(await mockConnectorFactory.GetData(channelId, userId, conversationId, BotStoreType.BotPrivateConversationData)); }); return(botsClient); }
public static Mock <IBots> MockIBots(MockConnectorFactory mockConnectorFactory) { var botsClient = new Moq.Mock <IBots>(MockBehavior.Loose); botsClient.Setup(d => d.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(botId, conversationId, data, headers, token) => { return(mockConnectorFactory.UpsertData(botId, null, conversationId, data)); }); botsClient.Setup(d => d.GetConversationDataWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns <string, string, Dictionary <string, List <string> >, CancellationToken>(async(botId, conversationId, headers, token) => { return(mockConnectorFactory.GetData(botId, null, conversationId)); }); botsClient.Setup(d => d.SetUserDataWithHttpMessagesAsync(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(botId, userId, data, headers, token) => { return(mockConnectorFactory.UpsertData(botId, userId, null, data)); }); botsClient.Setup(d => d.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(botId, userId, headers, token) => { return(mockConnectorFactory.GetData(botId, userId, null)); }); botsClient.Setup(d => d.SetPerUserInConversationDataWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <BotData>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns <string, string, string, BotData, Dictionary <string, List <string> >, CancellationToken>(async(botId, conversationId, userId, data, headers, token) => { return(mockConnectorFactory.UpsertData(botId, userId, conversationId, data)); }); botsClient.Setup(d => d.GetPerUserConversationDataWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns <string, string, string, Dictionary <string, List <string> >, CancellationToken>(async(botId, conversationId, userId, headers, token) => { return(mockConnectorFactory.GetData(botId, userId, conversationId)); }); return(botsClient); }
public Mock<StateClient> MockIBots(MockConnectorFactory mockConnectorFactory) { var botsClient = new Moq.Mock<StateClient>(MockBehavior.Loose); 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 mockConnectorFactory.UpsertData(botIdResolver.BotId, null, $"{channelId}-{conversationId}", data); }); botsClient.Setup(d => d.BotState.GetConversationDataWithHttpMessagesAsync(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, conversationId, headers, token) => { return mockConnectorFactory.GetData(botIdResolver.BotId, null, $"{channelId}-{conversationId}"); }); botsClient.Setup(d => d.BotState.SetUserDataWithHttpMessagesAsync(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, userId, data, headers, token) => { return mockConnectorFactory.UpsertData(botIdResolver.BotId, $"{channelId}-{userId}", null, data); }); 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 mockConnectorFactory.GetData(botIdResolver.BotId, $"{channelId}-{userId}", null); }); botsClient.Setup(d => d.BotState.SetPrivateConversationDataWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<BotData>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>())) .Returns<string, string, string, BotData, Dictionary<string, List<string>>, CancellationToken>(async (channelId, conversationId, userId, data, headers, token) => { return mockConnectorFactory.UpsertData(botIdResolver.BotId, $"{channelId}-{userId}", $"{channelId}-{conversationId}", data); }); botsClient.Setup(d => d.BotState.GetPrivateConversationDataWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>())) .Returns<string, string, string, Dictionary<string, List<string>>, CancellationToken>(async (channelId, conversationId, userId, headers, token) => { return mockConnectorFactory.GetData(botIdResolver.BotId, $"{channelId}-{userId}", $"{channelId}-{conversationId}"); }); return botsClient; }