diff --git a/tests/Microsoft.Bot.Builder.Tests/Microsoft.Bot.Builder.Tests.csproj b/tests/Microsoft.Bot.Builder.Tests/Microsoft.Bot.Builder.Tests.csproj index 2f479634b6..c60713e551 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Microsoft.Bot.Builder.Tests.csproj +++ b/tests/Microsoft.Bot.Builder.Tests/Microsoft.Bot.Builder.Tests.csproj @@ -11,7 +11,12 @@ - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Microsoft.Bot.Builder.Tests/Skills/SkillHandlerTests.cs b/tests/Microsoft.Bot.Builder.Tests/Skills/SkillHandlerTests.cs index e8ac70f11f..f393a4dd64 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Skills/SkillHandlerTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Skills/SkillHandlerTests.cs @@ -12,13 +12,12 @@ using Microsoft.Bot.Connector.Authentication; using Microsoft.Bot.Schema; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Newtonsoft.Json; +using Xunit; namespace Microsoft.Bot.Builder.Tests.Skills { - [TestClass] public class SkillHandlerTests { private readonly ClaimsIdentity _claimsIdentity; @@ -62,7 +61,7 @@ public SkillHandlerTests() _conversationId = _testConversationIdFactory.CreateSkillConversationIdAsync(options, CancellationToken.None).Result; } - [TestMethod] + [Fact] public async Task LegacyConversationIdFactoryTest() { var legacyFactory = new TestLegacyConversationIdFactory(); @@ -90,11 +89,11 @@ public async Task LegacyConversationIdFactoryTest() activity.ApplyConversationReference(conversationReference); await sut.TestOnSendToConversationAsync(_claimsIdentity, conversationId, (Activity)activity, CancellationToken.None); - Assert.IsNotNull(botCallback); + Assert.NotNull(botCallback); await botCallback.Invoke(new TurnContext(_mockAdapter.Object, (Activity)activity), CancellationToken.None); } - [TestMethod] + [Fact] public async Task OnSendToConversationAsyncTest() { BotCallbackHandler botCallback = null; @@ -109,14 +108,14 @@ public async Task OnSendToConversationAsyncTest() var activity = (Activity)Activity.CreateMessageActivity(); activity.ApplyConversationReference(_conversationReference); - Assert.IsNull(activity.CallerId); + Assert.Null(activity.CallerId); await sut.TestOnSendToConversationAsync(_claimsIdentity, _conversationId, activity, CancellationToken.None); - Assert.IsNotNull(botCallback); + Assert.NotNull(botCallback); await botCallback.Invoke(new TurnContext(_mockAdapter.Object, _conversationReference.GetContinuationActivity()), CancellationToken.None); - Assert.IsNull(activity.CallerId); + Assert.Null(activity.CallerId); } - [TestMethod] + [Fact] public async Task OnOnReplyToActivityAsyncTest() { BotCallbackHandler botCallback = null; @@ -133,28 +132,28 @@ public async Task OnOnReplyToActivityAsyncTest() activity.ApplyConversationReference(_conversationReference); await sut.TestOnReplyToActivityAsync(_claimsIdentity, _conversationId, activityId, activity, CancellationToken.None); - Assert.IsNotNull(botCallback); + Assert.NotNull(botCallback); await botCallback.Invoke(new TurnContext(_mockAdapter.Object, _conversationReference.GetContinuationActivity()), CancellationToken.None); - Assert.IsNull(activity.CallerId); + Assert.Null(activity.CallerId); } - [TestMethod] + [Fact] public async Task EventActivityAsyncTest() { var activity = (Activity)Activity.CreateEventActivity(); await TestActivityCallback(activity); - Assert.AreEqual($"{CallerIdConstants.BotToBotPrefix}{_skillId}", activity.CallerId); + Assert.Equal($"{CallerIdConstants.BotToBotPrefix}{_skillId}", activity.CallerId); } - [TestMethod] + [Fact] public async Task EndOfConversationActivityAsyncTest() { var activity = (Activity)Activity.CreateEndOfConversationActivity(); await TestActivityCallback(activity); - Assert.AreEqual($"{CallerIdConstants.BotToBotPrefix}{_skillId}", activity.CallerId); + Assert.Equal($"{CallerIdConstants.BotToBotPrefix}{_skillId}", activity.CallerId); } - [TestMethod] + [Fact] public async Task OnUpdateActivityAsyncTest() { var sut = CreateSkillHandlerForTesting(); @@ -162,112 +161,92 @@ public async Task OnUpdateActivityAsyncTest() var activityId = Guid.NewGuid().ToString("N"); activity.ApplyConversationReference(_conversationReference); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnUpdateActivityAsync(_claimsIdentity, _conversationId, activityId, (Activity)activity, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnUpdateActivityAsync(_claimsIdentity, _conversationId, activityId, (Activity)activity, CancellationToken.None)); } - [TestMethod] + [Fact] public async Task OnDeleteActivityAsyncTest() { var sut = CreateSkillHandlerForTesting(); var activityId = Guid.NewGuid().ToString("N"); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnDeleteActivityAsync(_claimsIdentity, _conversationId, activityId, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnDeleteActivityAsync(_claimsIdentity, _conversationId, activityId, CancellationToken.None)); } - [TestMethod] + [Fact] public async Task OnGetActivityMembersAsyncTest() { var sut = CreateSkillHandlerForTesting(); var activityId = Guid.NewGuid().ToString("N"); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnGetActivityMembersAsync(_claimsIdentity, _conversationId, activityId, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnGetActivityMembersAsync(_claimsIdentity, _conversationId, activityId, CancellationToken.None)); } - [TestMethod] + [Fact] public async Task OnCreateConversationAsyncTest() { var sut = CreateSkillHandlerForTesting(); var conversationParameters = new ConversationParameters(); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnCreateConversationAsync(_claimsIdentity, conversationParameters, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnCreateConversationAsync(_claimsIdentity, conversationParameters, CancellationToken.None)); } - [TestMethod] + [Fact] public async Task OnGetConversationsAsyncTest() { var sut = CreateSkillHandlerForTesting(); var conversationId = Guid.NewGuid().ToString("N"); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnGetConversationsAsync(_claimsIdentity, conversationId, string.Empty, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnGetConversationsAsync(_claimsIdentity, conversationId, string.Empty, CancellationToken.None)); } - [TestMethod] + [Fact] public async Task OnGetConversationMembersAsyncTest() { var sut = CreateSkillHandlerForTesting(); var conversationId = Guid.NewGuid().ToString("N"); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnGetConversationMembersAsync(_claimsIdentity, conversationId, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnGetConversationMembersAsync(_claimsIdentity, conversationId, CancellationToken.None)); } - [TestMethod] + [Fact] public async Task OnGetConversationPagedMembersAsyncTest() { var sut = CreateSkillHandlerForTesting(); var conversationId = Guid.NewGuid().ToString("N"); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnGetConversationPagedMembersAsync(_claimsIdentity, conversationId, null, null, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnGetConversationPagedMembersAsync(_claimsIdentity, conversationId, null, null, CancellationToken.None)); } - [TestMethod] + [Fact] public async Task OnDeleteConversationMemberAsyncTest() { var sut = CreateSkillHandlerForTesting(); var conversationId = Guid.NewGuid().ToString("N"); var memberId = Guid.NewGuid().ToString("N"); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnDeleteConversationMemberAsync(_claimsIdentity, conversationId, memberId, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnDeleteConversationMemberAsync(_claimsIdentity, conversationId, memberId, CancellationToken.None)); } - [TestMethod] + [Fact] public async Task OnSendConversationHistoryAsyncTest() { var sut = CreateSkillHandlerForTesting(); var conversationId = Guid.NewGuid().ToString("N"); var transcript = new Transcript(); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnSendConversationHistoryAsync(_claimsIdentity, conversationId, transcript, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnSendConversationHistoryAsync(_claimsIdentity, conversationId, transcript, CancellationToken.None)); } - [TestMethod] + [Fact] public async Task OnUploadAttachmentAsyncTest() { var sut = CreateSkillHandlerForTesting(); var conversationId = Guid.NewGuid().ToString("N"); var attachmentData = new AttachmentData(); - await Assert.ThrowsExceptionAsync(async () => - { - await sut.TestOnUploadAttachmentAsync(_claimsIdentity, conversationId, attachmentData, CancellationToken.None); - }); + await Assert.ThrowsAsync(() => + sut.TestOnUploadAttachmentAsync(_claimsIdentity, conversationId, attachmentData, CancellationToken.None)); } private async Task TestActivityCallback(Activity activity) @@ -286,7 +265,7 @@ private async Task TestActivityCallback(Activity activity) activity.ApplyConversationReference(_conversationReference); await sut.TestOnReplyToActivityAsync(_claimsIdentity, _conversationId, activityId, activity, CancellationToken.None); - Assert.IsNotNull(botCallback); + Assert.NotNull(botCallback); await botCallback.Invoke(new TurnContext(_mockAdapter.Object, activity), CancellationToken.None); } diff --git a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityExtensionsTests.cs b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityExtensionsTests.cs index 249a1253bb..021bf6d70b 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityExtensionsTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityExtensionsTests.cs @@ -3,14 +3,13 @@ using Microsoft.Bot.Schema; using Microsoft.Bot.Schema.Teams; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Xunit; namespace Microsoft.Bot.Builder.Teams.Tests { - [TestClass] public class TeamsActivityExtensionsTests { - [TestMethod] + [Fact] public void TeamsGetTeamId() { // Arrange @@ -20,10 +19,10 @@ public void TeamsGetTeamId() var teamId = activity.TeamsGetTeamInfo().Id; // Assert - Assert.AreEqual("team123", teamId); + Assert.Equal("team123", teamId); } - [TestMethod] + [Fact] public void TeamsGetTeamIdTyped() { // Arrange @@ -33,10 +32,10 @@ public void TeamsGetTeamIdTyped() var teamId = activity.TeamsGetTeamInfo().Id; // Assert - Assert.AreEqual("team123", teamId); + Assert.Equal("team123", teamId); } - [TestMethod] + [Fact] public void TeamsNotifyUser() { // Arrange @@ -46,10 +45,10 @@ public void TeamsNotifyUser() activity.TeamsNotifyUser(); // Assert - Assert.AreEqual(true, ((TeamsChannelData)activity.ChannelData).Notification.Alert); + Assert.Equal(true, ((TeamsChannelData)activity.ChannelData).Notification.Alert); } - [TestMethod] + [Fact] public void TeamsNotifyUserExistingNotification() { // Arrange @@ -59,8 +58,8 @@ public void TeamsNotifyUserExistingNotification() activity.TeamsNotifyUser(); // Assert - Assert.AreEqual(true, ((TeamsChannelData)activity.ChannelData).Notification.Alert); - Assert.AreEqual("team123", ((TeamsChannelData)activity.ChannelData).Team.Id); + Assert.Equal(true, ((TeamsChannelData)activity.ChannelData).Notification.Alert); + Assert.Equal("team123", ((TeamsChannelData)activity.ChannelData).Team.Id); } } } diff --git a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerBadRequestTests.cs b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerBadRequestTests.cs index a54970a83a..e1de85b572 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerBadRequestTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerBadRequestTests.cs @@ -1,20 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Threading; using System.Threading.Tasks; using Microsoft.Bot.Builder.Tests; using Microsoft.Bot.Schema; using Microsoft.Bot.Schema.Teams; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; +using Xunit; namespace Microsoft.Bot.Builder.Teams.Tests { - [TestClass] public class TeamsActivityHandlerBadRequestTests { - [TestMethod] + [Fact] public async Task TestFileConsentBadAction() { // Arrange @@ -47,13 +45,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(400, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(400, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSubmitActionPreviewBadAction() { // Arrange @@ -80,10 +78,10 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(400, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(400, ((InvokeResponse)activitiesToSend[0].Value).Status); } } } diff --git a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerHidingTests.cs b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerHidingTests.cs index f75ab76591..92aa835335 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerHidingTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerHidingTests.cs @@ -9,8 +9,8 @@ using System.Threading.Tasks; using Microsoft.Bot.Connector.Authentication; using Microsoft.Bot.Schema; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Xunit; namespace Microsoft.Bot.Builder.Teams.Tests { @@ -18,10 +18,9 @@ namespace Microsoft.Bot.Builder.Teams.Tests /// THese are the same tests as are performed on direct subclasses of ActivityHandler but this time the /// test bot is derived from ActivityHandler. /// - [TestClass] public class TeamsActivityHandlerHidingTests { - [TestMethod] + [Fact] public async Task TestMessageActivity() { // Arrange @@ -33,11 +32,11 @@ public async Task TestMessageActivity() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(1, bot.Record.Count); - Assert.AreEqual("OnMessageActivityAsync", bot.Record[0]); + Assert.Single(bot.Record); + Assert.Equal("OnMessageActivityAsync", bot.Record[0]); } - [TestMethod] + [Fact] public async Task TestEndOfConversationActivity() { // Arrange @@ -49,11 +48,11 @@ public async Task TestEndOfConversationActivity() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(1, bot.Record.Count); - Assert.AreEqual("OnEndOfConversationActivityAsync", bot.Record[0]); + Assert.Single(bot.Record); + Assert.Equal("OnEndOfConversationActivityAsync", bot.Record[0]); } - [TestMethod] + [Fact] public async Task TestTypingActivity() { // Arrange @@ -65,11 +64,11 @@ public async Task TestTypingActivity() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(1, bot.Record.Count); - Assert.AreEqual("OnTypingActivityAsync", bot.Record[0]); + Assert.Single(bot.Record); + Assert.Equal("OnTypingActivityAsync", bot.Record[0]); } - [TestMethod] + [Fact] public async Task TestMemberAdded1() { // Arrange @@ -89,11 +88,11 @@ public async Task TestMemberAdded1() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(1, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Single(bot.Record); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); } - [TestMethod] + [Fact] public async Task TestMemberAdded2() { // Arrange @@ -114,12 +113,12 @@ public async Task TestMemberAdded2() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnMembersAddedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnMembersAddedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestMemberAdded3() { // Arrange @@ -141,12 +140,12 @@ public async Task TestMemberAdded3() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnMembersAddedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnMembersAddedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestMemberRemoved1() { // Arrange @@ -166,11 +165,11 @@ public async Task TestMemberRemoved1() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(1, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Single(bot.Record); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); } - [TestMethod] + [Fact] public async Task TestMemberRemoved2() { // Arrange @@ -191,12 +190,12 @@ public async Task TestMemberRemoved2() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnMembersAddedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnMembersAddedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestMemberRemoved3() { // Arrange @@ -218,12 +217,12 @@ public async Task TestMemberRemoved3() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnMembersAddedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnMembersAddedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestMemberAddedJustTheBot() { // Arrange @@ -243,11 +242,11 @@ public async Task TestMemberAddedJustTheBot() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(1, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Single(bot.Record); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); } - [TestMethod] + [Fact] public async Task TestMemberRemovedJustTheBot() { // Arrange @@ -267,11 +266,11 @@ public async Task TestMemberRemovedJustTheBot() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(1, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Single(bot.Record); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); } - [TestMethod] + [Fact] public async Task TestMessageReaction() { // Note the code supports multiple adds and removes in the same activity though @@ -298,13 +297,13 @@ public async Task TestMessageReaction() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(3, bot.Record.Count); - Assert.AreEqual("OnMessageReactionActivityAsync", bot.Record[0]); - Assert.AreEqual("OnReactionsAddedAsync", bot.Record[1]); - Assert.AreEqual("OnReactionsRemovedAsync", bot.Record[2]); + Assert.Equal(3, bot.Record.Count); + Assert.Equal("OnMessageReactionActivityAsync", bot.Record[0]); + Assert.Equal("OnReactionsAddedAsync", bot.Record[1]); + Assert.Equal("OnReactionsRemovedAsync", bot.Record[2]); } - [TestMethod] + [Fact] public async Task TestTokenResponseEventAsync() { // Arrange @@ -320,12 +319,12 @@ public async Task TestTokenResponseEventAsync() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnEventActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTokenResponseEventAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnEventActivityAsync", bot.Record[0]); + Assert.Equal("OnTokenResponseEventAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestEventAsync() { // Arrange @@ -341,12 +340,12 @@ public async Task TestEventAsync() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnEventActivityAsync", bot.Record[0]); - Assert.AreEqual("OnEventAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnEventActivityAsync", bot.Record[0]); + Assert.Equal("OnEventAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestEventNullNameAsync() { // Arrange @@ -361,12 +360,12 @@ public async Task TestEventNullNameAsync() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnEventActivityAsync", bot.Record[0]); - Assert.AreEqual("OnEventAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnEventActivityAsync", bot.Record[0]); + Assert.Equal("OnEventAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestUnrecognizedActivityType() { // Arrange @@ -381,11 +380,11 @@ public async Task TestUnrecognizedActivityType() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(1, bot.Record.Count); - Assert.AreEqual("OnUnrecognizedActivityTypeAsync", bot.Record[0]); + Assert.Single(bot.Record); + Assert.Equal("OnUnrecognizedActivityTypeAsync", bot.Record[0]); } - [TestMethod] + [Fact] public async Task TestDelegatingTurnContext() { // Arrange diff --git a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerNotImplementedTests.cs b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerNotImplementedTests.cs index 7dcc63fe9c..6842725a2c 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerNotImplementedTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerNotImplementedTests.cs @@ -6,15 +6,14 @@ using Microsoft.Bot.Builder.Tests; using Microsoft.Bot.Schema; using Microsoft.Bot.Schema.Teams; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; +using Xunit; namespace Microsoft.Bot.Builder.Teams.Tests { - [TestClass] public class TeamsActivityHandlerNotImplementedTests { - [TestMethod] + [Fact] public async Task TestInvoke() { // Arrange @@ -37,13 +36,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestFileConsentAccept() { // Arrange @@ -76,13 +75,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestFileConsentDecline() { // Arrange @@ -115,13 +114,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestActionableMessageExecuteAction() { // Arrange @@ -145,13 +144,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestComposeExtensionQueryLink() { // Arrange @@ -175,13 +174,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestComposeExtensionQuery() { // Arrange @@ -205,13 +204,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSelectItemAsync() { // Arrange @@ -235,10 +234,10 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } public async Task TestMessagingExtensionSubmitAction() @@ -264,13 +263,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSubmitActionPreviewActionEdit() { // Arrange @@ -297,13 +296,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSubmitActionPreviewActionSend() { // Arrange @@ -330,13 +329,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionFetchTask() { // Arrange @@ -360,13 +359,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionConfigurationQuerySettingsUrl() { // Arrange @@ -389,13 +388,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionConfigurationSetting() { // Arrange @@ -418,13 +417,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestTaskModuleFetch() { // Arrange @@ -448,13 +447,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestTaskModuleSubmit() { // Arrange @@ -478,13 +477,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(501, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(501, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestFileConsentAcceptImplemented() { // Arrange @@ -517,13 +516,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestFileConsentDeclineImplemented() { // Arrange @@ -556,13 +555,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSubmitActionPreviewActionEditImplemented() { // Arrange @@ -589,13 +588,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSubmitActionPreviewActionSendImplemented() { // Arrange @@ -622,10 +621,10 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } private class TestActivityHandler : TeamsActivityHandler diff --git a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerTests.cs b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerTests.cs index 809b7c0e55..29b5ff34c4 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsActivityHandlerTests.cs @@ -15,17 +15,16 @@ using Microsoft.Bot.Schema; using Microsoft.Bot.Schema.Teams; using Microsoft.Rest.Serialization; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; +using Xunit; namespace Microsoft.Bot.Builder.Teams.Tests { - [TestClass] public class TeamsActivityHandlerTests { - [TestMethod] + [Fact] public async Task TestConversationUpdateBotTeamsMemberAdded() { // Arrange @@ -58,12 +57,12 @@ public async Task TestConversationUpdateBotTeamsMemberAdded() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMembersAddedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMembersAddedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestConversationUpdateTeamsMemberAdded() { // Arrange @@ -101,12 +100,12 @@ public async Task TestConversationUpdateTeamsMemberAdded() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMembersAddedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMembersAddedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestConversationUpdateTeamsMemberAddedNoTeam() { // Arrange @@ -137,12 +136,12 @@ public async Task TestConversationUpdateTeamsMemberAddedNoTeam() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMembersAddedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMembersAddedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestConversationUpdateTeamsMemberAddedFullDetailsInEvent() { // Arrange @@ -211,12 +210,12 @@ public async Task TestConversationUpdateTeamsMemberAddedFullDetailsInEvent() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMembersAddedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMembersAddedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestConversationUpdateTeamsMemberRemoved() { // Arrange @@ -238,12 +237,12 @@ public async Task TestConversationUpdateTeamsMemberRemoved() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMembersRemovedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMembersRemovedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestConversationUpdateTeamsChannelCreated() { // Arrange @@ -260,12 +259,12 @@ public async Task TestConversationUpdateTeamsChannelCreated() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsChannelCreatedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsChannelCreatedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestConversationUpdateTeamsChannelDeleted() { // Arrange @@ -282,12 +281,12 @@ public async Task TestConversationUpdateTeamsChannelDeleted() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsChannelDeletedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsChannelDeletedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestConversationUpdateTeamsChannelRenamed() { // Arrange @@ -304,12 +303,12 @@ public async Task TestConversationUpdateTeamsChannelRenamed() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsChannelRenamedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsChannelRenamedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestConversationUpdateTeamsTeamRenamed() { // Arrange @@ -326,12 +325,12 @@ public async Task TestConversationUpdateTeamsTeamRenamed() await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnConversationUpdateActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsTeamRenamedAsync", bot.Record[1]); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnConversationUpdateActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsTeamRenamedAsync", bot.Record[1]); } - [TestMethod] + [Fact] public async Task TestFileConsentAccept() { // Arrange @@ -364,17 +363,17 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(3, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsFileConsentAsync", bot.Record[1]); - Assert.AreEqual("OnTeamsFileConsentAcceptAsync", bot.Record[2]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(3, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsFileConsentAsync", bot.Record[1]); + Assert.Equal("OnTeamsFileConsentAcceptAsync", bot.Record[2]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestFileConsentDecline() { // Arrange @@ -407,17 +406,17 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(3, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsFileConsentAsync", bot.Record[1]); - Assert.AreEqual("OnTeamsFileConsentDeclineAsync", bot.Record[2]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(3, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsFileConsentAsync", bot.Record[1]); + Assert.Equal("OnTeamsFileConsentDeclineAsync", bot.Record[2]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestActionableMessageExecuteAction() { // Arrange @@ -441,16 +440,16 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsO365ConnectorCardActionAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsO365ConnectorCardActionAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestComposeExtensionQueryLink() { // Arrange @@ -474,16 +473,16 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsAppBasedLinkQueryAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsAppBasedLinkQueryAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestComposeExtensionQuery() { // Arrange @@ -507,16 +506,16 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMessagingExtensionQueryAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMessagingExtensionQueryAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSelectItemAsync() { // Arrange @@ -540,16 +539,16 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMessagingExtensionSelectItemAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMessagingExtensionSelectItemAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSubmitAction() { // Arrange @@ -573,17 +572,17 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(3, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMessagingExtensionSubmitActionDispatchAsync", bot.Record[1]); - Assert.AreEqual("OnTeamsMessagingExtensionSubmitActionAsync", bot.Record[2]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(3, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMessagingExtensionSubmitActionDispatchAsync", bot.Record[1]); + Assert.Equal("OnTeamsMessagingExtensionSubmitActionAsync", bot.Record[2]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSubmitActionPreviewActionEdit() { // Arrange @@ -610,17 +609,17 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(3, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMessagingExtensionSubmitActionDispatchAsync", bot.Record[1]); - Assert.AreEqual("OnTeamsMessagingExtensionBotMessagePreviewEditAsync", bot.Record[2]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(3, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMessagingExtensionSubmitActionDispatchAsync", bot.Record[1]); + Assert.Equal("OnTeamsMessagingExtensionBotMessagePreviewEditAsync", bot.Record[2]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionSubmitActionPreviewActionSend() { // Arrange @@ -647,17 +646,17 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(3, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMessagingExtensionSubmitActionDispatchAsync", bot.Record[1]); - Assert.AreEqual("OnTeamsMessagingExtensionBotMessagePreviewSendAsync", bot.Record[2]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(3, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMessagingExtensionSubmitActionDispatchAsync", bot.Record[1]); + Assert.Equal("OnTeamsMessagingExtensionBotMessagePreviewSendAsync", bot.Record[2]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionFetchTask() { // Arrange @@ -681,16 +680,16 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMessagingExtensionFetchTaskAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMessagingExtensionFetchTaskAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionConfigurationQuerySettingUrl() { // Arrange @@ -714,16 +713,16 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMessagingExtensionConfigurationQuerySettingUrlAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMessagingExtensionConfigurationQuerySettingUrlAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestMessagingExtensionConfigurationSetting() { // Arrange @@ -747,16 +746,16 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsMessagingExtensionConfigurationSettingAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsMessagingExtensionConfigurationSettingAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestTaskModuleFetch() { // Arrange @@ -780,16 +779,16 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsTaskModuleFetchAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsTaskModuleFetchAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestTaskModuleSubmit() { // Arrange @@ -813,16 +812,16 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsTaskModuleSubmitAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsTaskModuleSubmitAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } - [TestMethod] + [Fact] public async Task TestSigninVerifyState() { // Arrange @@ -845,13 +844,13 @@ void CaptureSend(Activity[] arg) await ((IBot)bot).OnTurnAsync(turnContext); // Assert - Assert.AreEqual(2, bot.Record.Count); - Assert.AreEqual("OnInvokeActivityAsync", bot.Record[0]); - Assert.AreEqual("OnTeamsSigninVerifyStateAsync", bot.Record[1]); - Assert.IsNotNull(activitiesToSend); - Assert.AreEqual(1, activitiesToSend.Length); - Assert.IsInstanceOfType(activitiesToSend[0].Value, typeof(InvokeResponse)); - Assert.AreEqual(200, ((InvokeResponse)activitiesToSend[0].Value).Status); + Assert.Equal(2, bot.Record.Count); + Assert.Equal("OnInvokeActivityAsync", bot.Record[0]); + Assert.Equal("OnTeamsSigninVerifyStateAsync", bot.Record[1]); + Assert.NotNull(activitiesToSend); + Assert.Single(activitiesToSend); + Assert.IsType(activitiesToSend[0].Value); + Assert.Equal(200, ((InvokeResponse)activitiesToSend[0].Value).Status); } private class NotImplementedAdapter : BotAdapter diff --git a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsInfoTests.cs b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsInfoTests.cs index 32c967a27a..c414db9b84 100644 --- a/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsInfoTests.cs +++ b/tests/Microsoft.Bot.Builder.Tests/Teams/TeamsInfoTests.cs @@ -12,15 +12,14 @@ using Microsoft.Bot.Connector.Authentication; using Microsoft.Bot.Schema; using Microsoft.Bot.Schema.Teams; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; +using Xunit; namespace Microsoft.Bot.Builder.Teams.Tests { - [TestClass] public class TeamsInfoTests { - [TestMethod] + [Fact] public async Task TestSendMessageToTeamsChannelAsync() { var baseUri = new Uri("https://test.coffee"); @@ -51,7 +50,7 @@ public async Task TestSendMessageToTeamsChannelAsync() await handler.OnTurnAsync(turnContext); } - [TestMethod] + [Fact] public async Task TestGetTeamDetailsAsync() { var baseUri = new Uri("https://test.coffee"); @@ -82,7 +81,7 @@ public async Task TestGetTeamDetailsAsync() await handler.OnTurnAsync(turnContext); } - [TestMethod] + [Fact] public async Task TestTeamGetMembersAsync() { var baseUri = new Uri("https://test.coffee"); @@ -113,7 +112,7 @@ public async Task TestTeamGetMembersAsync() await handler.OnTurnAsync(turnContext); } - [TestMethod] + [Fact] public async Task TestGroupChatGetMembersAsync() { var baseUri = new Uri("https://test.coffee"); @@ -138,7 +137,7 @@ public async Task TestGroupChatGetMembersAsync() await handler.OnTurnAsync(turnContext); } - [TestMethod] + [Fact] public async Task TestGetChannelsAsync() { var baseUri = new Uri("https://test.coffee"); @@ -169,7 +168,7 @@ public async Task TestGetChannelsAsync() await handler.OnTurnAsync(turnContext); } - [TestMethod] + [Fact] public async Task TestGetMemberAsync() { var baseUri = new Uri("https://test.coffee"); @@ -201,7 +200,7 @@ public async Task TestGetMemberAsync() await handler.OnTurnAsync(turnContext); } - [TestMethod] + [Fact] public async Task TestGetMemberNoTeamAsync() { var baseUri = new Uri("https://test.coffee"); @@ -254,7 +253,7 @@ public override async Task OnTurnAsync(ITurnContext turnContext, CancellationTok await CallTeamGetMemberAsync(turnContext); break; default: - Assert.IsTrue(false); + Assert.True(false); break; } } @@ -267,77 +266,77 @@ private async Task CallSendMessageToTeamsChannelAsync(ITurnContext turnContext) var cancelToken = new CancellationToken(); var reference = await TeamsInfo.SendMessageToTeamsChannelAsync(turnContext, message, channelId, creds, cancelToken); - Assert.AreEqual(reference.Item1.ActivityId, "activityId123"); - Assert.AreEqual(reference.Item1.ChannelId, "channelId123"); - Assert.AreEqual(reference.Item1.ServiceUrl, "https://test.coffee"); - Assert.AreEqual(reference.Item2, "activityId123"); + Assert.Equal(reference.Item1.ActivityId, "activityId123"); + Assert.Equal(reference.Item1.ChannelId, channelId); + Assert.Equal(reference.Item1.ServiceUrl, turnContext.Activity.ServiceUrl); + Assert.Equal(reference.Item2, "activityId123"); } private async Task CallGetTeamDetailsAsync(ITurnContext turnContext) { var teamDetails = await TeamsInfo.GetTeamDetailsAsync(turnContext); - Assert.AreEqual("team-id", teamDetails.Id); - Assert.AreEqual("team-name", teamDetails.Name); - Assert.AreEqual("team-aadgroupid", teamDetails.AadGroupId); + Assert.Equal("team-id", teamDetails.Id); + Assert.Equal("team-name", teamDetails.Name); + Assert.Equal("team-aadgroupid", teamDetails.AadGroupId); } private async Task CallTeamGetMembersAsync(ITurnContext turnContext) { var members = (await TeamsInfo.GetMembersAsync(turnContext)).ToArray(); - Assert.AreEqual("id-1", members[0].Id); - Assert.AreEqual("name-1", members[0].Name); - Assert.AreEqual("givenName-1", members[0].GivenName); - Assert.AreEqual("surname-1", members[0].Surname); - Assert.AreEqual("userPrincipalName-1", members[0].UserPrincipalName); - - Assert.AreEqual("id-2", members[1].Id); - Assert.AreEqual("name-2", members[1].Name); - Assert.AreEqual("givenName-2", members[1].GivenName); - Assert.AreEqual("surname-2", members[1].Surname); - Assert.AreEqual("userPrincipalName-2", members[1].UserPrincipalName); + Assert.Equal("id-1", members[0].Id); + Assert.Equal("name-1", members[0].Name); + Assert.Equal("givenName-1", members[0].GivenName); + Assert.Equal("surname-1", members[0].Surname); + Assert.Equal("userPrincipalName-1", members[0].UserPrincipalName); + + Assert.Equal("id-2", members[1].Id); + Assert.Equal("name-2", members[1].Name); + Assert.Equal("givenName-2", members[1].GivenName); + Assert.Equal("surname-2", members[1].Surname); + Assert.Equal("userPrincipalName-2", members[1].UserPrincipalName); } private async Task CallTeamGetMemberAsync(ITurnContext turnContext) { var member = await TeamsInfo.GetMemberAsync(turnContext, turnContext.Activity.From.Id); - Assert.AreEqual("id-1", member.Id); - Assert.AreEqual("name-1", member.Name); - Assert.AreEqual("givenName-1", member.GivenName); - Assert.AreEqual("surname-1", member.Surname); - Assert.AreEqual("userPrincipalName-1", member.UserPrincipalName); + Assert.Equal("id-1", member.Id); + Assert.Equal("name-1", member.Name); + Assert.Equal("givenName-1", member.GivenName); + Assert.Equal("surname-1", member.Surname); + Assert.Equal("userPrincipalName-1", member.UserPrincipalName); } private async Task CallGroupChatGetMembersAsync(ITurnContext turnContext) { var members = (await TeamsInfo.GetMembersAsync(turnContext)).ToArray(); - Assert.AreEqual("id-3", members[0].Id); - Assert.AreEqual("name-3", members[0].Name); - Assert.AreEqual("givenName-3", members[0].GivenName); - Assert.AreEqual("surname-3", members[0].Surname); - Assert.AreEqual("userPrincipalName-3", members[0].UserPrincipalName); - - Assert.AreEqual("id-4", members[1].Id); - Assert.AreEqual("name-4", members[1].Name); - Assert.AreEqual("givenName-4", members[1].GivenName); - Assert.AreEqual("surname-4", members[1].Surname); - Assert.AreEqual("userPrincipalName-4", members[1].UserPrincipalName); + Assert.Equal("id-3", members[0].Id); + Assert.Equal("name-3", members[0].Name); + Assert.Equal("givenName-3", members[0].GivenName); + Assert.Equal("surname-3", members[0].Surname); + Assert.Equal("userPrincipalName-3", members[0].UserPrincipalName); + + Assert.Equal("id-4", members[1].Id); + Assert.Equal("name-4", members[1].Name); + Assert.Equal("givenName-4", members[1].GivenName); + Assert.Equal("surname-4", members[1].Surname); + Assert.Equal("userPrincipalName-4", members[1].UserPrincipalName); } private async Task CallGetChannelsAsync(ITurnContext turnContext) { var channels = (await TeamsInfo.GetTeamChannelsAsync(turnContext)).ToArray(); - Assert.AreEqual("channel-id-1", channels[0].Id); + Assert.Equal("channel-id-1", channels[0].Id); - Assert.AreEqual("channel-id-2", channels[1].Id); - Assert.AreEqual("channel-name-2", channels[1].Name); + Assert.Equal("channel-id-2", channels[1].Id); + Assert.Equal("channel-name-2", channels[1].Name); - Assert.AreEqual("channel-id-3", channels[2].Id); - Assert.AreEqual("channel-name-3", channels[2].Name); + Assert.Equal("channel-id-3", channels[2].Id); + Assert.Equal("channel-name-3", channels[2].Name); } }