microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
core/sso-in-channels

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

44lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4using System.Text.Json.Nodes;
5using Microsoft.Teams.Apps.Handlers;
6using Microsoft.Teams.Apps.Schema;
7using Microsoft.Teams.Core.Schema;
8
9namespace Microsoft.Teams.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 // Build from JSON so that conversation lands in Properties as a JsonElement
28 CoreActivity coreActivity = CoreActivity.FromJsonString("""
29 {
30 "type": "invoke",
31 "value": { "key": "value" },
32 "conversation": { "id": "convId" },
33 "name": "testName"
34 }
35 """);
36 InvokeActivity ia = InvokeActivity.FromActivity(coreActivity);
37 Assert.NotNull(ia);
38 Assert.Equal(TeamsActivityType.Invoke, ia.Type);
39 Assert.Equal("testName", ia.Name);
40 Assert.NotNull(ia.Value);
41 Assert.Equal("convId", ia.Conversation?.Id);
42 Assert.Equal("value", ia.Value?["key"]?.ToString());
43 }
44}
45