Browse Source

IsSingleton => Singleton

pull/304/head
Sebastian 8 years ago
parent
commit
34d278cba1
  1. 6
      src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs
  2. 4
      src/Squidex.Domain.Apps.Entities/Schemas/ISchemaEntity.cs
  3. 4
      src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs
  4. 10
      tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs
  5. 2
      tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaGrainTests.cs

6
src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs

@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards
ValidateData(command, e);
});
if (schema.IsSingleton && command.ContentId != Guid.Empty)
if (schema.Singleton && command.ContentId != Guid.Empty)
{
throw new DomainException("Singleton content cannot be created.");
}
@ -65,7 +65,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards
{
Guard.NotNull(command, nameof(command));
if (schema.IsSingleton && command.Status != Status.Published)
if (schema.Singleton && command.Status != Status.Published)
{
throw new DomainException("Singleton content archived or unpublished.");
}
@ -102,7 +102,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards
{
Guard.NotNull(command, nameof(command));
if (schema.IsSingleton)
if (schema.Singleton)
{
throw new DomainException("Singleton content cannot be deleted.");
}

4
src/Squidex.Domain.Apps.Entities/Schemas/ISchemaEntity.cs

@ -23,9 +23,9 @@ namespace Squidex.Domain.Apps.Entities.Schemas
string Category { get; }
bool IsPublished { get; }
bool Singleton { get; }
bool IsSingleton { get; }
bool IsPublished { get; }
bool IsDeleted { get; }

4
src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs

@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.State
public bool IsDeleted { get; set; }
[JsonProperty]
public bool IsSingleton { get; set; }
public bool Singleton { get; set; }
[JsonProperty]
public string ScriptQuery { get; set; }
@ -68,7 +68,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.State
{
Name = @event.Name;
IsSingleton = @event.Singleton;
Singleton = @event.Singleton;
var schema = new Schema(@event.Name);

10
tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs

@ -35,7 +35,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
[Fact]
public void CanCreate_should_throw_exception_if_singleton()
{
A.CallTo(() => schema.IsSingleton).Returns(true);
A.CallTo(() => schema.Singleton).Returns(true);
var command = new CreateContent { Data = new NamedContentData() };
@ -45,7 +45,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
[Fact]
public void CanCreate_should_not_throw_exception_if_singleton_and_id_empty()
{
A.CallTo(() => schema.IsSingleton).Returns(true);
A.CallTo(() => schema.Singleton).Returns(true);
var command = new CreateContent { Data = new NamedContentData(), ContentId = Guid.Empty };
@ -133,7 +133,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
[Fact]
public void CanChangeContentStatus_should_throw_exception_if_singleton()
{
A.CallTo(() => schema.IsSingleton).Returns(true);
A.CallTo(() => schema.Singleton).Returns(true);
var command = new ChangeContentStatus { Status = Status.Draft };
@ -143,7 +143,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
[Fact]
public void CanChangeContentStatus_should_not_throw_exception_if_publishing_with_pending_changes()
{
A.CallTo(() => schema.IsSingleton).Returns(true);
A.CallTo(() => schema.Singleton).Returns(true);
var command = new ChangeContentStatus { Status = Status.Published };
@ -177,7 +177,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
[Fact]
public void CanDelete_should_throw_exception_if_singleton()
{
A.CallTo(() => schema.IsSingleton).Returns(true);
A.CallTo(() => schema.Singleton).Returns(true);
var command = new DeleteContent();

2
tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaGrainTests.cs

@ -72,7 +72,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas
Assert.Equal(SchemaName, sut.Snapshot.Name);
Assert.Equal(SchemaName, sut.Snapshot.SchemaDef.Name);
Assert.True(sut.Snapshot.IsSingleton);
Assert.True(sut.Snapshot.Singleton);
LastEvents
.ShouldHaveSameEvents(

Loading…
Cancel
Save