-
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.
Merge branch 'master' of github.com:stefanforsberg/WhiteMagic
- Loading branch information
Showing
4 changed files
with
107 additions
and
159 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
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,73 @@ | ||
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"), 1, 1); | ||
} | ||
|
||
[Test] | ||
public void it_should_return_the_expected_page() | ||
{ | ||
Children.First().PageName.ShouldBe("ChildPage2"); | ||
} | ||
|
||
[Test] | ||
public void it_should_only_return_one_page() | ||
{ | ||
Children.Count().ShouldBe(1); | ||
} | ||
} | ||
|
||
public class when_skipping_two_pagse_and_getting_two_pages : when_getting_children_using_startindex_and_maxrows | ||
{ | ||
public override void When() | ||
{ | ||
base.When(); | ||
|
||
Children = ContentRepository.GetChildren<PageData>(StartPageReference, new LanguageSelector("en"), 2, 2); | ||
} | ||
|
||
[Test] | ||
public void it_should_return_the_expected_page() | ||
{ | ||
Children.First().PageName.ShouldBe("ChildPage3"); | ||
Children.Last().PageName.ShouldBe("ChildPage4"); | ||
} | ||
|
||
[Test] | ||
public void it_should_return_two_pages() | ||
{ | ||
Children.Count().ShouldBe(2); | ||
} | ||
} | ||
} |
Oops, something went wrong.