-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-74 :: add more Article unit tests - starter branch
- Loading branch information
1 parent
72f0599
commit 966cca5
Showing
2 changed files
with
40 additions
and
0 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
33 changes: 33 additions & 0 deletions
33
...Guides.Web.Tests/Features/Articles/Widgets/ArticleList/ArticleListWidgetViewModelTests.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,33 @@ | ||
using Xunit; | ||
using TrainingGuides.Web.Features.Articles.Widgets.ArticleList; | ||
using TrainingGuides.Web.Features.Articles; | ||
|
||
namespace TrainingGuides.Web.Tests.Features.Articles.Widgets.ArticleList; | ||
|
||
public class ArticleListWidgetViewModelTests | ||
{ | ||
private readonly ArticleListWidgetViewModel emptyWidgetViewModel; | ||
|
||
public ArticleListWidgetViewModelTests() | ||
{ | ||
emptyWidgetViewModel = new(); | ||
} | ||
|
||
[Fact] | ||
public void WhenInitialized_ArticlesIsEmptyList() => Assert.Empty(emptyWidgetViewModel.Articles); | ||
|
||
[Fact] | ||
public void WhenInitialized_CtaTextIsEmpty() => Assert.Equal(string.Empty, emptyWidgetViewModel.CtaText); | ||
|
||
[Fact] | ||
public void IsMisconfigured_When_ArticlesEmpty_ReturnsTrue() => Assert.True(emptyWidgetViewModel.IsMisconfigured); | ||
|
||
[Fact] | ||
public void IsMisconfigured_When_ArticlesContainItems_ReturnsFalse() | ||
{ | ||
var widgetViewModel = new ArticleListWidgetViewModel(); | ||
widgetViewModel.Articles.Add(new ArticlePageViewModel()); | ||
|
||
Assert.False(widgetViewModel.IsMisconfigured); | ||
} | ||
} |