public async Task TestSendAndReplyToConversationAsync(string activityType, string replyToId)
        {
            // Arrange
            var mockObjects = new CloudSkillHandlerTestMocks();
            var activity    = new Activity(activityType)
            {
                ReplyToId = replyToId
            };
            var conversationId = await mockObjects.CreateAndApplyConversationIdAsync(activity);

            // Act
            var sut      = new CloudSkillHandler(mockObjects.Adapter.Object, mockObjects.Bot.Object, mockObjects.ConversationIdFactory, mockObjects.Auth.Object);
            var response = replyToId == null ? await sut.HandleSendToConversationAsync(TestAuthHeader, conversationId, activity) : await sut.HandleReplyToActivityAsync(TestAuthHeader, conversationId, replyToId, activity);

            // Assert
            // Assert the turnContext.
            Assert.Equal($"{CallerIdConstants.BotToBotPrefix}{TestSkillId}", mockObjects.TurnContext.Activity.CallerId);
            Assert.NotNull(mockObjects.TurnContext.TurnState.Get <SkillConversationReference>(CloudSkillHandler.SkillConversationReferenceKey));

            // Assert based on activity type,
            if (activityType == ActivityTypes.Message)
            {
                // Should be sent to the channel and not to the bot.
                Assert.NotNull(mockObjects.ChannelActivity);
                Assert.Null(mockObjects.BotActivity);

                // We should get the resourceId returned by the mock.
                Assert.Equal("resourceId", response.Id);

                // Assert the activity sent to the channel.
                Assert.Equal(activityType, mockObjects.ChannelActivity.Type);
                Assert.Null(mockObjects.ChannelActivity.CallerId);
                Assert.Equal(replyToId, mockObjects.ChannelActivity.ReplyToId);
            }
            else
            {
                // Should be sent to the bot and not to the channel.
                Assert.Null(mockObjects.ChannelActivity);
                Assert.NotNull(mockObjects.BotActivity);

                // If the activity is bounced back to the bot we will get a GUID and not the mocked resourceId.
                Assert.NotEqual("resourceId", response.Id);

                // Assert the activity sent back to the bot.
                Assert.Equal(activityType, mockObjects.BotActivity.Type);
                Assert.Equal(replyToId, mockObjects.BotActivity.ReplyToId);
            }
        }
        public async Task TestDeleteActivityAsync()
        {
            // Arrange
            var mockObjects    = new CloudSkillHandlerTestMocks();
            var activity       = new Activity(ActivityTypes.Message);
            var conversationId = await mockObjects.CreateAndApplyConversationIdAsync(activity);

            var activityToDelete = Guid.NewGuid().ToString();

            // Act
            var sut = new CloudSkillHandler(mockObjects.Adapter.Object, mockObjects.Bot.Object, mockObjects.ConversationIdFactory, mockObjects.Auth.Object);
            await sut.HandleDeleteActivityAsync(TestAuthHeader, conversationId, activityToDelete);

            // Assert
            Assert.NotNull(mockObjects.TurnContext.TurnState.Get <SkillConversationReference>(CloudSkillHandler.SkillConversationReferenceKey));
            Assert.Equal(activityToDelete, mockObjects.ActivityIdToDelete);
        }
        public async void TestUpdateActivityAsync()
        {
            // Arrange
            var mockObjects = new CloudSkillHandlerTestMocks();
            var activity    = new Activity(ActivityTypes.Message)
            {
                Text = $"TestUpdate {DateTime.Now}."
            };
            var conversationId = await mockObjects.CreateAndApplyConversationIdAsync(activity);

            var activityToUpdate = Guid.NewGuid().ToString();

            // Act
            var sut      = new CloudSkillHandler(mockObjects.Adapter.Object, mockObjects.Bot.Object, mockObjects.ConversationIdFactory, mockObjects.Auth.Object);
            var response = await sut.HandleUpdateActivityAsync(TestAuthHeader, conversationId, activityToUpdate, activity);

            // Assert
            Assert.Equal("resourceId", response.Id);
            Assert.NotNull(mockObjects.TurnContext.TurnState.Get <SkillConversationReference>(CloudSkillHandler.SkillConversationReferenceKey));
            Assert.Equal(activityToUpdate, mockObjects.TurnContext.Activity.Id);
            Assert.Equal(activity.Text, mockObjects.UpdateActivity.Text);
        }