Skip to content

Commit

Permalink
Added another test for when saving a page
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanforsberg committed Mar 20, 2013
1 parent 5496b09 commit 8dbc548
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/WhiteMagic.Tests/ContentRepository/when_saving_a_page.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using EPiServer.Core;
using EPiServer.DataAccess;
using EPiServer.Security;
using NUnit.Framework;
using Shouldly;
using WhiteMagic.Tests.Pages;

namespace WhiteMagic.Tests.ContentRepository
{
public class when_saving_a_page : TestBase
public class when_creating_a_page_and_save_it : TestBase
{
private StartPage _loadedPage;
private PageReference _startPageReference;
Expand Down Expand Up @@ -60,4 +62,34 @@ public void it_should_not_return_a_value_set_when_page_is_not_saved_afterwards()
.ShouldBe("Hejhej!");
}
}

public class when_editing_an_existing_page_and_then_save_it : TestBase
{
private PageReference _startPageReference;

public override void Given()
{
base.Given();
_startPageReference = ContentRepository
.Publish<StartPage>(ContentReference.RootPage, p => p.MainBody = "Hejhej!");
}

public override void When()
{
base.When();

var startPage = ContentRepository.Get<StartPage>(_startPageReference);
startPage.MainBody = "An edited mainbody";
ContentRepository.Save(startPage, SaveAction.Publish, AccessLevel.NoAccess);
}

[Test]
public void it_should_return_the_edited_page()
{
ContentRepository
.Get<StartPage>(_startPageReference)
.MainBody
.ShouldBe("An edited mainbody");
}
}
}

0 comments on commit 8dbc548

Please sign in to comment.