microsoft/teams.net

Public

mirrored fromhttps://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
samples/migration-bot

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

core/test/Microsoft.Teams.Bot.Apps.UnitTests/InvokeActivityTest.cs

45lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4using System.Text.Json.Nodes;
5using Microsoft.Teams.Bot.Apps.Handlers;
6using Microsoft.Teams.Bot.Apps.Schema;
7using Microsoft.Teams.Bot.Core.Schema;
8
9namespace Microsoft.Teams.Bot.Apps.UnitTests;
10
11public class InvokeActivityTest
12{
13 [Fact]
14 public void DefaultCtor()
15 {
16 InvokeActivity ia = new();
17 Assert.NotNull(ia);
18 Assert.Equal(TeamsActivityType.Invoke, ia.Type);
19 Assert.Null(ia.Name);
20 Assert.Null(ia.Value);
21 // Assert.Null(ia.Conversation);
22 }
23
24 [Fact]
25 public void FromCoreActivityWithValue()
26 {
27 CoreActivity coreActivity = new()
28 {
29 Type = TeamsActivityType.Invoke,
30 Value = JsonNode.Parse("{ \"key\": \"value\" }"),
31 Conversation = new Conversation { Id = "convId" },
32 Properties = new ExtendedPropertiesDictionary
33 {
34 { "name", "testName" }
35 }
36 };
37 InvokeActivity ia = InvokeActivity.FromActivity(coreActivity);
38 Assert.NotNull(ia);
39 Assert.Equal(TeamsActivityType.Invoke, ia.Type);
40 Assert.Equal("testName", ia.Name);
41 Assert.NotNull(ia.Value);
42 Assert.Equal("convId", ia.Conversation?.Id);
43 Assert.Equal("value", ia.Value?["key"]?.ToString());
44 }
45}
46