-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First stab at paging support for getchildren
- Loading branch information
1 parent
b29a71f
commit e1fb7a6
Showing
3 changed files
with
67 additions
and
14 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/WhiteMagic.Tests/ContentRepository/when_getting_children_using_startindex_and_maxrows.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,50 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using EPiServer.Core; | ||
using NUnit.Framework; | ||
using Shouldly; | ||
using WhiteMagic.Tests.Pages; | ||
|
||
namespace WhiteMagic.Tests.ContentRepository | ||
{ | ||
public class when_getting_children_using_startindex_and_maxrows : TestBase | ||
{ | ||
protected PageReference StartPageReference; | ||
protected IEnumerable<PageData> Children; | ||
|
||
public override void Given() | ||
{ | ||
base.Given(); | ||
|
||
StartPageReference = ContentRepository.Publish<StartPage>(ContentReference.RootPage); | ||
|
||
ContentRepository.Publish<StandardPage>(StartPageReference, "ChildPage1"); | ||
ContentRepository.Publish<StandardPage>(StartPageReference, "ChildPage2"); | ||
ContentRepository.Publish<StandardPage>(StartPageReference, "ChildPage3"); | ||
ContentRepository.Publish<StandardPage>(StartPageReference, "ChildPage4"); | ||
ContentRepository.Publish<StandardPage>(StartPageReference, "ChildPage5"); | ||
} | ||
} | ||
|
||
public class when_skipping_first_page_and_only_getting_one_page : when_getting_children_using_startindex_and_maxrows | ||
{ | ||
public override void When() | ||
{ | ||
base.When(); | ||
|
||
Children = ContentRepository.GetChildren<PageData>(StartPageReference, new LanguageSelector("en"), 2, 1); | ||
} | ||
|
||
[Test] | ||
public void it_should_return_the_expected_page() | ||
{ | ||
Children.First().PageName.ShouldBe("ChildPage3"); | ||
} | ||
|
||
[Test] | ||
public void it_should_only_return_one_page() | ||
{ | ||
Children.Count().ShouldBe(1); | ||
} | ||
} | ||
} |
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