-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Unit Tests] Add Unit Tests in .razor files (#844)
* Add Razor Unit Tests * Fix gitignore
- Loading branch information
Showing
8 changed files
with
83 additions
and
50 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
File renamed without changes.
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,31 @@ | ||
@using Xunit; | ||
@inherits TestContext | ||
@code | ||
{ | ||
[Fact] | ||
public void FluentButton_Title() | ||
{ | ||
// Arrange && Act | ||
var cut = Render(@<FluentButton Title="My Title">My button</FluentButton>); | ||
|
||
// Assert | ||
cut.Verify(); | ||
} | ||
|
||
[Fact] | ||
public void FluentButton_OnClick() | ||
{ | ||
bool clicked = false; | ||
|
||
// Arrange | ||
var cut = Render(@<FluentButton OnClick="@(e => { clicked = true; } )"> | ||
My button | ||
</FluentButton>); | ||
|
||
// Act | ||
cut.Find("fluent-button").Click(); | ||
|
||
// Assert | ||
Assert.True(clicked); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using Microsoft.AspNetCore.Components.Web | ||
@using Microsoft.JSInterop | ||
@using Microsoft.Extensions.DependencyInjection | ||
@using AngleSharp.Dom | ||
@using Bunit | ||
@using Bunit.TestDoubles | ||
@using Microsoft.Fast.Components.FluentUI | ||
@using Microsoft.Fast.Components.FluentUI.Tests |