microsoft/teams.net

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
22df127116ef02cc5a31f714736cc25de03d7f9a

Branches

Tags

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

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.Apps.Testing/Events/App.cs

31lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4using Microsoft.Teams.Apps.Events;
5using Microsoft.Teams.Apps.Testing.Plugins;
6
7namespace Microsoft.Teams.Apps.Testing.Events;
8
9public class TestMessageEvent : Event
10{
11 public required string Message { get; set; }
12}
13
14public static partial class AppExtensions
15{
16 public static App OnTestMessage(this App app, Action<TestPlugin, TestMessageEvent> handler)
17 {
18 return app.OnEvent("test.message", (plugin, @event) =>
19 {
20 handler((TestPlugin)plugin, (TestMessageEvent)@event);
21 });
22 }
23
24 public static App OnTestMessage(this App app, Func<TestPlugin, TestMessageEvent, CancellationToken, Task<object?>> handler)
25 {
26 return app.OnEvent("test.message", (plugin, @event, token) =>
27 {
28 return handler((TestPlugin)plugin, (TestMessageEvent)@event, token);
29 });
30 }
31}