microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
releases/core

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

43lines · modecode

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