-
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.
- Loading branch information
1 parent
a4110c2
commit 437cde2
Showing
3 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
SonghayCore.Tests/Extensions/MenuDisplayItemModelExtensionsTests.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 @@ | ||
using Songhay.Models; | ||
|
||
namespace Songhay.Tests.Extensions; | ||
|
||
public class MenuDisplayItemModelExtensionsTests | ||
{ | ||
// ReSharper disable once InconsistentNaming | ||
public static IEnumerable<object[]> GetAllByData = | ||
new[] | ||
{ | ||
new object[] | ||
{ | ||
new MenuDisplayItemModel | ||
{ | ||
GroupId = "g-42", | ||
ChildItems = | ||
new [] | ||
{ | ||
new MenuDisplayItemModel(), | ||
new MenuDisplayItemModel { GroupId = "g-42" }, | ||
new MenuDisplayItemModel | ||
{ | ||
ChildItems = new [] | ||
{ | ||
new MenuDisplayItemModel { GroupId = "g-42" }, | ||
} | ||
} | ||
} | ||
}, | ||
(MenuDisplayItemModel i) => i.HasGroupId("g-42"), // predicate | ||
3 // expectedNumberOfItems | ||
} | ||
}; | ||
|
||
[Theory] | ||
[MemberData(nameof(GetAllByData))] | ||
public void GetAllBy_Test(MenuDisplayItemModel data, Func<MenuDisplayItemModel, bool> predicate, int expectedNumberOfItems) | ||
{ | ||
var actual = data.GetAllBy(predicate).ToArray(); | ||
Assert.NotEmpty(actual); | ||
Assert.Equal(expectedNumberOfItems, actual.Length); | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.