コード例 #1
0
        public async Task _BadArgs()
        {
            try
            {
                await store.LogActivityAsync(null);

                Assert.Fail("LogActivity Should have thrown on null ");
            }
            catch (ArgumentNullException) { }
            catch { Assert.Fail("LogActivity Should have thrown ArgumentNull exception on null "); }

            try
            {
                await store.GetTranscriptActivitiesAsync(null, null);

                Assert.Fail("GetConversationActivities Should have thrown on null");
            }
            catch (ArgumentNullException) { }
            catch { Assert.Fail("DeleteConversation Should have thrown ArgumentNull "); }

            try
            {
                await store.GetTranscriptActivitiesAsync("asdfds", null);

                Assert.Fail("GetConversationActivities Should have thrown on null");
            }
            catch (ArgumentNullException) { }
            catch { Assert.Fail("DeleteConversation Should have thrown ArgumentNull "); }

            try
            {
                await store.ListTranscriptsAsync(null);

                Assert.Fail("ListConversations Should have thrown on null");
            }
            catch (ArgumentNullException) { }
            catch { Assert.Fail("ListConversations Should have thrown ArgumentNull "); }

            try
            {
                await store.DeleteTranscriptAsync(null, null);

                Assert.Fail("DeleteConversation Should have thrown on null channelId");
            }
            catch (ArgumentNullException) { }
            catch { Assert.Fail("DeleteConversation Should have thrown ArgumentNull on channelId"); }

            try
            {
                await store.DeleteTranscriptAsync("test", null);

                Assert.Fail("DeleteConversation Should have thrown on null conversationId");
            }
            catch (ArgumentNullException) { }
            catch { Assert.Fail("DeleteConversation Should have thrown ArgumentNull on conversationId"); }
        }
        public async Task ElasticsearchTranscriptStore_ListTranscriptsTest()
        {
            // Arrange
            var activity = new Activity();

            activity.ChannelId       = "TestChannelId";
            activity.Conversation    = new ConversationAccount();
            activity.Conversation.Id = "TestConversationId";
            activity.Timestamp       = DateTimeOffset.Now;

            for (int i = 0; i < 50; i++)
            {
                // Log activity.
                await transcriptStore.LogActivityAsync(activity);

                // Update timestamp.
                activity.Timestamp = DateTimeOffset.Now.AddSeconds(1);
            }

            // Act
            var result      = new List <TranscriptInfo>();
            var pagedResult = new PagedResult <TranscriptInfo>();

            do
            {
                pagedResult = await transcriptStore.ListTranscriptsAsync(activity.ChannelId, pagedResult.ContinuationToken);

                foreach (var item in pagedResult.Items)
                {
                    result.Add(item);
                }

                Assert.AreNotEqual(0, pagedResult.Items.Length);
            }while (pagedResult.ContinuationToken != null);

            // Assert
            Assert.AreNotEqual(0, result.Count);
        }