microsoft/teams.net

Public

mirrored from https://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
docs/update-release-process

Branches

Tags

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

Clone

HTTPS

Download ZIP

Tests/Microsoft.Teams.Api.Tests/ConversationTests.cs

70lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4namespace Microsoft.Teams.Api.Tests;
5
6public class ConversationTests
7{
8 [Fact]
9 public void ToThreadedConversationId_ConstructsThreadedConversationId()
10 {
11 var result = Conversation.ToThreadedConversationId("19:abc@thread.skype", "1680000000000");
12 Assert.Equal("19:abc@thread.skype;messageid=1680000000000", result);
13 }
14
15 [Fact]
16 public void ToThreadedConversationId_WorksWithDifferentConversationIdFormats()
17 {
18 var result = Conversation.ToThreadedConversationId("19:meeting_abc@thread.v2", "999");
19 Assert.Equal("19:meeting_abc@thread.v2;messageid=999", result);
20 }
21
22 [Fact]
23 public void ToThreadedConversationId_ThrowsOnEmptyConversationId()
24 {
25 Assert.Throws<ArgumentException>(() => Conversation.ToThreadedConversationId("", "123"));
26 }
27
28 [Fact]
29 public void ToThreadedConversationId_ThrowsOnNullConversationId()
30 {
31 Assert.Throws<ArgumentException>(() => Conversation.ToThreadedConversationId(null!, "123"));
32 }
33
34 [Fact]
35 public void ToThreadedConversationId_ThrowsOnEmptyMessageId()
36 {
37 Assert.Throws<ArgumentException>(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", ""));
38 }
39
40 [Fact]
41 public void ToThreadedConversationId_ThrowsOnZeroMessageId()
42 {
43 Assert.Throws<ArgumentException>(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", "0"));
44 }
45
46 [Fact]
47 public void ToThreadedConversationId_ThrowsOnNonNumericMessageId()
48 {
49 Assert.Throws<ArgumentException>(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", "abc"));
50 }
51
52 [Fact]
53 public void ToThreadedConversationId_ThrowsOnNegativeMessageId()
54 {
55 Assert.Throws<ArgumentException>(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", "-1"));
56 }
57
58 [Fact]
59 public void ToThreadedConversationId_ThrowsOnDecimalMessageId()
60 {
61 Assert.Throws<ArgumentException>(() => Conversation.ToThreadedConversationId("19:abc@thread.skype", "1.5"));
62 }
63
64 [Fact]
65 public void ToThreadedConversationId_StripsExistingMessageIdAndReplacesWithThreadRoot()
66 {
67 var result = Conversation.ToThreadedConversationId("19:abc@thread.skype;messageid=111", "222");
68 Assert.Equal("19:abc@thread.skype;messageid=222", result);
69 }
70}
71