|
|
|
@ -203,6 +203,22 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards |
|
|
|
GuardSchemaField.CanUpdate(schema_0, command); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void CanUpdate_should_throw_exception_if_properties_null() |
|
|
|
{ |
|
|
|
var command = new UpdateField { FieldId = 2, Properties = null }; |
|
|
|
|
|
|
|
Assert.Throws<ValidationException>(() => GuardSchemaField.CanUpdate(schema_0, command)); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void CanUpdate_should_throw_exception_if_properties_not_valid() |
|
|
|
{ |
|
|
|
var command = new UpdateField { FieldId = 2, Properties = new StringFieldProperties { MinLength = 10, MaxLength = 5 } }; |
|
|
|
|
|
|
|
Assert.Throws<ValidationException>(() => GuardSchemaField.CanUpdate(schema_0, command)); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void CanAdd_should_throw_exception_if_field_already_exists() |
|
|
|
{ |
|
|
|
@ -227,6 +243,14 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards |
|
|
|
Assert.Throws<ValidationException>(() => GuardSchemaField.CanAdd(schema_0, command)); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void CanAdd_should_throw_exception_if_properties_null() |
|
|
|
{ |
|
|
|
var command = new AddField { Name = "field3", Properties = null }; |
|
|
|
|
|
|
|
Assert.Throws<ValidationException>(() => GuardSchemaField.CanAdd(schema_0, command)); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void CanAdd_should_throw_exception_if_partitioning_not_valid() |
|
|
|
{ |
|
|
|
|