-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Part 7] [Unit Tests - Code Coverage]: Microsoft.Bot.Schema.Teams (#5664
) * O365ConnectorCardOpenUri: simplified default vals. + tests * O365ConnectorCard -OpenUriTarget, -Section: simplified default vals. + tests * O365ConnectorCardTextInput: simplified default vals. + tests * O365ConnectorCardViewAction, SigninStateVerificationQuery: tests
- Loading branch information
Showing
12 changed files
with
267 additions
and
33 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
34 changes: 34 additions & 0 deletions
34
tests/Microsoft.Bot.Schema.Tests/Teams/O365ConnectorCardOpenUriTargetTests.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,34 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Bot.Schema.Teams; | ||
using Xunit; | ||
|
||
namespace Microsoft.Bot.Schema.Tests.Teams | ||
{ | ||
public class O365ConnectorCardOpenUriTargetTests | ||
{ | ||
[Fact] | ||
public void O365ConnectorCardOpenUriTargetInits() | ||
{ | ||
var os = "default"; | ||
var uri = "www.bing.com"; | ||
|
||
var openUriTarget = new O365ConnectorCardOpenUriTarget(os, uri); | ||
|
||
Assert.NotNull(openUriTarget); | ||
Assert.IsType<O365ConnectorCardOpenUriTarget>(openUriTarget); | ||
Assert.Equal(os, openUriTarget.Os); | ||
Assert.Equal(uri, openUriTarget.Uri); | ||
} | ||
|
||
[Fact] | ||
public void O365ConnectorCardOpenUriTargetInitsWithNoArgs() | ||
{ | ||
var openUriTarget = new O365ConnectorCardOpenUriTarget(); | ||
|
||
Assert.NotNull(openUriTarget); | ||
Assert.IsType<O365ConnectorCardOpenUriTarget>(openUriTarget); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
tests/Microsoft.Bot.Schema.Tests/Teams/O365ConnectorCardOpenUriTests.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,39 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Bot.Schema.Teams; | ||
using Xunit; | ||
|
||
namespace Microsoft.Bot.Schema.Tests.Teams | ||
{ | ||
public class O365ConnectorCardOpenUriTests | ||
{ | ||
[Fact] | ||
public void O365ConnectorCardOpenUriInits() | ||
{ | ||
var type = "OpenUri"; | ||
var name = "Go to Bing"; | ||
var id = "goToBing"; | ||
var targets = new List<O365ConnectorCardOpenUriTarget>() { new O365ConnectorCardOpenUriTarget("default", "www.bing.com") }; | ||
|
||
var openUri = new O365ConnectorCardOpenUri(type, name, id, targets); | ||
|
||
Assert.NotNull(openUri); | ||
Assert.IsType<O365ConnectorCardOpenUri>(openUri); | ||
Assert.Equal(name, openUri.Name); | ||
Assert.Equal(id, openUri.Id); | ||
Assert.Equal(targets, openUri.Targets); | ||
Assert.Equal(1, openUri.Targets.Count); | ||
} | ||
|
||
[Fact] | ||
public void O365ConnectorCardOpenUriInitsWithNoArgs() | ||
{ | ||
var openUri = new O365ConnectorCardOpenUri(); | ||
|
||
Assert.NotNull(openUri); | ||
Assert.IsType<O365ConnectorCardOpenUri>(openUri); | ||
} | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
tests/Microsoft.Bot.Schema.Tests/Teams/O365ConnectorCardSectionTests.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,64 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Bot.Schema.Teams; | ||
using Xunit; | ||
|
||
namespace Microsoft.Bot.Schema.Tests.Teams | ||
{ | ||
public class O365ConnectorCardSectionTests | ||
{ | ||
[Fact] | ||
public void O365ConnectorCardSectionInits() | ||
{ | ||
var title = "Donut Selection"; | ||
var text = "Choose a Donut"; | ||
var activityTitle = "Donut"; | ||
var activitySubtitle = "Select an image below."; | ||
var activityText = "Select the image of the donut you wish to order."; | ||
var activityImage = "https://example-of-donut.com"; | ||
var activityImageType = "article"; | ||
var markdown = false; | ||
var facts = new List<O365ConnectorCardFact>() | ||
{ | ||
new O365ConnectorCardFact("jelly"), | ||
new O365ConnectorCardFact("powdered"), | ||
}; | ||
var images = new List<O365ConnectorCardImage>() | ||
{ | ||
new O365ConnectorCardImage("https://jelly.com"), | ||
new O365ConnectorCardImage("https://powdered.com") | ||
}; | ||
var potentialAction = new List<O365ConnectorCardActionBase>() { new O365ConnectorCardActionBase("OpenUri") }; | ||
|
||
var section = new O365ConnectorCardSection(title, text, activityTitle, activitySubtitle, activityText, activityImage, activityImageType, markdown, facts, images, potentialAction); | ||
|
||
Assert.NotNull(section); | ||
Assert.IsType<O365ConnectorCardSection>(section); | ||
Assert.Equal(title, section.Title); | ||
Assert.Equal(text, section.Text); | ||
Assert.Equal(activityTitle, section.ActivityTitle); | ||
Assert.Equal(activitySubtitle, section.ActivitySubtitle); | ||
Assert.Equal(activityText, section.ActivityText); | ||
Assert.Equal(activityImage, section.ActivityImage); | ||
Assert.Equal(activityImageType, section.ActivityImageType); | ||
Assert.Equal(markdown, section.Markdown); | ||
Assert.Equal(facts, section.Facts); | ||
Assert.Equal(2, section.Facts.Count); | ||
Assert.Equal(images, section.Images); | ||
Assert.Equal(2, section.Images.Count); | ||
Assert.Equal(potentialAction, section.PotentialAction); | ||
Assert.Equal(1, section.PotentialAction.Count); | ||
} | ||
|
||
[Fact] | ||
public void O365ConnectorCardSectionInitsWithNoArgs() | ||
{ | ||
var section = new O365ConnectorCardSection(); | ||
|
||
Assert.NotNull(section); | ||
Assert.IsType<O365ConnectorCardSection>(section); | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
tests/Microsoft.Bot.Schema.Tests/Teams/O365ConnectorCardTextInputTests.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,43 @@ | ||
// Copyright(c) Microsoft Corporation.All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Bot.Schema.Teams; | ||
using Xunit; | ||
|
||
namespace Microsoft.Bot.Schema.Tests.Teams | ||
{ | ||
public class O365ConnectorCardTextInputTests | ||
{ | ||
[Fact] | ||
public void O365ConnectorCardTextInputInits() | ||
{ | ||
var type = "textInput"; | ||
var id = "firstName"; | ||
var isRequired = true; | ||
var title = "Profile"; | ||
var value = "First Name"; | ||
var isMultiline = false; | ||
var maxLength = 250; | ||
|
||
var textInput = new O365ConnectorCardTextInput(type, id, isRequired, title, value, isMultiline, maxLength); | ||
|
||
Assert.NotNull(textInput); | ||
Assert.IsType<O365ConnectorCardTextInput>(textInput); | ||
Assert.Equal(id, textInput.Id); | ||
Assert.Equal(isRequired, textInput.IsRequired); | ||
Assert.Equal(title, textInput.Title); | ||
Assert.Equal(value, textInput.Value); | ||
Assert.Equal(isMultiline, textInput.IsMultiline); | ||
Assert.Equal(maxLength, textInput.MaxLength); | ||
} | ||
|
||
[Fact] | ||
public void O365ConnectorCardTextInputInitsWithNoArgs() | ||
{ | ||
var textInput = new O365ConnectorCardTextInput(); | ||
|
||
Assert.NotNull(textInput); | ||
Assert.IsType<O365ConnectorCardTextInput>(textInput); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
tests/Microsoft.Bot.Schema.Tests/Teams/O365ConnectorCardViewActionTests.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,39 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Bot.Schema.Teams; | ||
using Xunit; | ||
|
||
namespace Microsoft.Bot.Schema.Tests.Teams | ||
{ | ||
public class O365ConnectorCardViewActionTests | ||
{ | ||
[Fact] | ||
public void O365ConnectorCardViewActionInits() | ||
{ | ||
var type = "ViewAction"; | ||
var name = "Custom Action"; | ||
var id = "customAction"; | ||
var target = new List<string>() { "https://example.com" }; | ||
|
||
var viewAction = new O365ConnectorCardViewAction(type, name, id, target); | ||
|
||
Assert.NotNull(viewAction); | ||
Assert.IsType<O365ConnectorCardViewAction>(viewAction); | ||
Assert.Equal(name, viewAction.Name); | ||
Assert.Equal(id, viewAction.Id); | ||
Assert.Equal(target, viewAction.Target); | ||
Assert.Equal(1, viewAction.Target.Count); | ||
} | ||
|
||
[Fact] | ||
public void O365ConnectorCardViewActionInitsWithNoArgs() | ||
{ | ||
var viewAction = new O365ConnectorCardViewAction(); | ||
|
||
Assert.NotNull(viewAction); | ||
Assert.IsType<O365ConnectorCardViewAction>(viewAction); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
tests/Microsoft.Bot.Schema.Tests/Teams/SigninStateVerificationQueryTests.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,32 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Bot.Schema.Teams; | ||
using Xunit; | ||
|
||
namespace Microsoft.Bot.Schema.Tests.Teams | ||
{ | ||
public class SigninStateVerificationQueryTests | ||
{ | ||
[Fact] | ||
public void SigninStateVerificationQueryInits() | ||
{ | ||
var state = "OK"; | ||
|
||
var verificationQuery = new SigninStateVerificationQuery(state); | ||
|
||
Assert.NotNull(verificationQuery); | ||
Assert.IsType<SigninStateVerificationQuery>(verificationQuery); | ||
Assert.Equal(state, verificationQuery.State); | ||
} | ||
|
||
[Fact] | ||
public void SigninStateVerificationQueryInitsWithNoArgs() | ||
{ | ||
var verificationQuery = new SigninStateVerificationQuery(); | ||
|
||
Assert.NotNull(verificationQuery); | ||
Assert.IsType<SigninStateVerificationQuery>(verificationQuery); | ||
} | ||
} | ||
} |