Fixes issue relating to the fix for U4-2589 where we need to clear the published db flag for previous versions when creating a new published version.

This commit is contained in:
Shannon
2013-08-13 11:01:49 +10:00
parent 86811fe507
commit c52c452b36
3 changed files with 104 additions and 1 deletions

View File

@@ -82,6 +82,61 @@ namespace Umbraco.Tests.Models
}
[Test]
public void Should_Clear_Published_Flag_When_Newly_Published_Version()
{
var contentType = MockedContentTypes.CreateTextpageContentType();
var content = MockedContent.CreateTextpageContent(contentType, "Textpage", -1);
content.ResetDirtyProperties(false);
content.ChangePublishedState(PublishedState.Published);
Assert.IsTrue(content.ShouldClearPublishedFlagForPreviousVersions());
}
[Test]
public void Should_Not_Clear_Published_Flag_When_Saving_Version()
{
var contentType = MockedContentTypes.CreateTextpageContentType();
var content = MockedContent.CreateTextpageContent(contentType, "Textpage", -1);
content.ResetDirtyProperties(false);
content.ChangePublishedState(PublishedState.Published);
content.ResetDirtyProperties(false);
content.ChangePublishedState(PublishedState.Saved);
Assert.IsFalse(content.ShouldClearPublishedFlagForPreviousVersions());
}
[Test]
public void Should_Clear_Published_Flag_When_Unpublishing_From_Published()
{
var contentType = MockedContentTypes.CreateTextpageContentType();
var content = MockedContent.CreateTextpageContent(contentType, "Textpage", -1);
content.ResetDirtyProperties(false);
content.ChangePublishedState(PublishedState.Published);
content.ResetDirtyProperties(false);
content.ChangePublishedState(PublishedState.Unpublished);
Assert.IsTrue(content.ShouldClearPublishedFlagForPreviousVersions());
}
[Test]
public void Should_Not_Clear_Published_Flag_When_Unpublishing_From_Saved()
{
var contentType = MockedContentTypes.CreateTextpageContentType();
var content = MockedContent.CreateTextpageContent(contentType, "Textpage", -1);
content.ResetDirtyProperties(false);
content.ChangePublishedState(PublishedState.Saved);
content.ResetDirtyProperties(false);
content.ChangePublishedState(PublishedState.Unpublished);
Assert.IsFalse(content.ShouldClearPublishedFlagForPreviousVersions());
}
}
}