예제 #1
0
        public async Task UpdateActivityWithMessageFactory()
        {
            const string ACTIVITY_ID     = "activity ID";
            const string CONVERSATION_ID = "conversation ID";

            var foundActivity = false;

            void ValidateUpdate(Activity activity)
            {
                Assert.NotNull(activity);
                Assert.True(activity.Id == ACTIVITY_ID);
                Assert.True(activity.Conversation.Id == CONVERSATION_ID);
                foundActivity = true;
            }

            var a = new SimpleAdapter(ValidateUpdate);
            var c = new TurnContext(a, new Activity(conversation: new ConversationAccount(id: CONVERSATION_ID)));

            var message = MessageFactory.Text("test text");

            message.Id = ACTIVITY_ID;

            var updateResult = await c.UpdateActivityAsync(message);

            Assert.True(foundActivity);
            Assert.True(updateResult.Id == ACTIVITY_ID);

            c.Dispose();
        }