public void CanEnable_should_throw_exception_if_ui_field() { var command = new EnableField { FieldId = 4 }; Assert.Throws <DomainException>(() => GuardSchemaField.CanEnable(command, schema_0)); }
public void CanAdd_should_throw_exception_if_partitioning_not_valid() { var command = new AddField { Name = "field5", Partitioning = "INVALID_PARTITIONING", Properties = validProperties }; ValidationAssert.Throws(() => GuardSchemaField.CanAdd(command, schema_0), new ValidationError("Partitioning is not a valid value.", "Partitioning")); }
public void CanAdd_should_throw_exception_if_properties_null() { var command = new AddField { Name = "field5", Properties = null ! }; ValidationAssert.Throws(() => GuardSchemaField.CanAdd(command, schema_0), new ValidationError("Properties is required.", "Properties")); }
public void CanAdd_should_throw_exception_if_properties_not_valid() { var command = new AddField { Name = "field5", Properties = invalidProperties }; ValidationAssert.Throws(() => GuardSchemaField.CanAdd(command, schema_0), new ValidationError("Max length must be greater or equal to min length.", "Properties.MinLength", "Properties.MaxLength")); }
public void CanAdd_should_throw_exception_if_name_not_valid() { var command = new AddField { Name = "INVALID_NAME", Properties = validProperties }; ValidationAssert.Throws(() => GuardSchemaField.CanAdd(command, schema_0), new ValidationError("Name is not a Javascript property name.", "Name")); }
public void CanAdd_should_throw_exception_if_nested_field_already_exists() { var command = new AddField { Name = "field301", Properties = validProperties, ParentFieldId = 3 }; ValidationAssert.Throws(() => GuardSchemaField.CanAdd(command, schema_0), new ValidationError("A field with the same name already exists.")); }
public void CanUpdate_should_throw_exception_if_properties_null() { var command = new UpdateField { FieldId = 2, Properties = null ! }; ValidationAssert.Throws(() => GuardSchemaField.CanUpdate(command, schema_0), new ValidationError("Properties is required.", "Properties")); }
public void CanDisable_should_not_throw_exception_if_already_disabled() { var command = new DisableField { FieldId = 1 }; var schema_1 = schema_0.UpdateField(1, f => f.Disable()); GuardSchemaField.CanDisable(command, schema_1); }
public void CanUpdate_should_throw_exception_if_locked() { var command = new UpdateField { FieldId = 1, Properties = validProperties }; var schema_1 = schema_0.UpdateField(1, f => f.Lock()); Assert.Throws <DomainException>(() => GuardSchemaField.CanUpdate(command, schema_1)); }
public void CanShow_should_throw_exception_if_locked() { var command = new ShowField { FieldId = 1 }; var schema_1 = schema_0.UpdateField(1, f => f.Lock()); Assert.Throws <DomainException>(() => GuardSchemaField.CanShow(command, schema_1)); }
public void CanShow_should_not_throw_exception_if_already_shown() { var command = new EnableField { FieldId = 1 }; var schema_1 = schema_0.UpdateField(1, f => f.Show()); GuardSchemaField.CanEnable(command, schema_1); }
public void CanUpdate_should_throw_exception_if_properties_not_valid() { var command = new UpdateField { FieldId = 2, Properties = new StringFieldProperties { MinLength = 10, MaxLength = 5 } }; ValidationAssert.Throws(() => GuardSchemaField.CanUpdate(command, schema_0), new ValidationError("Max length must be greater or equal to min length.", "Properties.MinLength", "Properties.MaxLength")); }