-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Google Adapter: Google Content Type not set to UTF-8 * Alexa Adapter: Add person to alexasystem to support Alexa voiceprint to know the ID of the speaker (#198) - Thanks @jamesemann * TwitterAdapter: Added unit tests (#197) - Thanks @matiasroldan6 @santgr11 * DevOps: Azure DevOps Pipelines GitVersion issue * Dependencies: Update to Bot Framework SDK 4.8
- Loading branch information
1 parent
8d5383d
commit 08a21b9
Showing
34 changed files
with
745 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
tests/Bot.Builder.Community.Adapters.Tests/ActivityExtensionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System.Collections.Generic; | ||
using Bot.Builder.Community.Adapters.Twitter.Webhooks.Models; | ||
using Bot.Builder.Community.Adapters.Twitter.Webhooks.Models.Twitter; | ||
using Microsoft.Bot.Schema; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Bot.Builder.Community.Adapters.Twitter.Tests | ||
{ | ||
[TestClass] | ||
[TestCategory("Twitter")] | ||
public class ActivityExtensionsTests | ||
{ | ||
[TestMethod] | ||
public void AsTwitterMessageWithEmptyMessageShouldFail() | ||
{ | ||
var activity = new Activity() | ||
{ | ||
Text = null, | ||
Type = ActivityTypes.Message | ||
}; | ||
|
||
Assert.ThrowsException<TwitterException>( | ||
() => | ||
{ | ||
activity.AsTwitterMessage(); | ||
}, "You can't send an empty message."); | ||
} | ||
|
||
[TestMethod] | ||
public void AsTwitterMessageWithLongMessageShouldFail() | ||
{ | ||
var activity = new Activity() | ||
{ | ||
Text = new string('a', 10001), | ||
Type = ActivityTypes.Message | ||
}; | ||
|
||
Assert.ThrowsException<TwitterException>( | ||
() => | ||
{ | ||
activity.AsTwitterMessage(); | ||
}, "Invalid message, the length of the message should be less than 10000 chars."); | ||
} | ||
|
||
[TestMethod] | ||
public void AsTwitterMessageShouldReturnNewDirectMessage() | ||
{ | ||
var activity = new Activity() | ||
{ | ||
Text = "test", | ||
Type = ActivityTypes.Message, | ||
Recipient = new ChannelAccount() | ||
{ | ||
Id = null | ||
} | ||
}; | ||
|
||
Assert.IsInstanceOfType(activity.AsTwitterMessage(), typeof(NewDirectMessageObject)); | ||
} | ||
|
||
[TestMethod] | ||
public void AsTwitterMessageShouldReturnNewDirectMessageWithQuickReply() | ||
{ | ||
var activity = new Activity() | ||
{ | ||
Text = "test", | ||
Type = ActivityTypes.Message, | ||
Recipient = new ChannelAccount() | ||
{ | ||
Id = null | ||
}, | ||
SuggestedActions = new SuggestedActions() | ||
{ | ||
Actions = new List<CardAction> { new CardAction(ActionTypes.OpenUrl, "Get Started", value: "https://docs.microsoft.com/bot-framework") } | ||
} | ||
}; | ||
|
||
Assert.IsInstanceOfType(activity.AsTwitterMessage().Event.MessageCreate.MessageData.QuickReply, typeof(NewEvent_QuickReply)); | ||
} | ||
} | ||
} |
Oops, something went wrong.