-
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
52 additions
and
2 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
36 changes: 36 additions & 0 deletions
36
src/WhiteMagic.Tests/ContentRepository/when_getting_a_page.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,36 @@ | ||
using EPiServer.Core; | ||
using NUnit.Framework; | ||
using WhiteMagic.Tests.Pages; | ||
|
||
namespace WhiteMagic.Tests.ContentRepository | ||
{ | ||
public class when_getting_a_page : TestBase | ||
{ | ||
protected PageReference StartPageReference; | ||
|
||
public override void Given() | ||
{ | ||
base.Given(); | ||
StartPageReference = ContentRepository | ||
.Publish<StartPage>(ContentReference.RootPage, p => p.MainBody = "Hejhej!"); | ||
} | ||
} | ||
|
||
public class when_getting_a_page_with_wrong_type_constraint : when_getting_a_page | ||
{ | ||
[Test] | ||
public void it_should_throw_a_type_mismatch_exception() | ||
{ | ||
Assert.Throws<TypeMismatchException>(() =>ContentRepository.Get<StandardPage>(StartPageReference)); | ||
} | ||
} | ||
|
||
public class when_getting_a_page_by_content_reference_that_does_not_exist : when_getting_a_page | ||
{ | ||
[Test] | ||
public void it_should_throw_a_page_not_found_exception() | ||
{ | ||
Assert.Throws<PageNotFoundException>(() => ContentRepository.Get<StandardPage>(new ContentReference(1000))); | ||
} | ||
} | ||
} |
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