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_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 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 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 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_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 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_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 CanDisable_should_throw_exception_if_already_disabled() { var command = new DisableField { FieldId = 1 }; var schema_1 = schema_0.DisableField(1); Assert.Throws <DomainException>(() => GuardSchemaField.CanDisable(schema_1, command)); }
public void CanHide_should_throw_exception_if_already_hidden() { var command = new HideField { FieldId = 1 }; var schema_1 = schema_0.HideField(1); Assert.Throws <DomainException>(() => GuardSchemaField.CanHide(schema_1, command)); }
public void CanUpdate_should_throw_exception_if_locked() { var command = new UpdateField { FieldId = 1, Properties = new StringFieldProperties() }; var schema_1 = schema_0.LockField(1); Assert.Throws <DomainException>(() => GuardSchemaField.CanUpdate(schema_1, command)); }
public void CanDelete_should_throw_exception_if_locked() { var command = new DeleteField { FieldId = 1 }; var schema_1 = schema_0.LockField(1); Assert.Throws <DomainException>(() => GuardSchemaField.CanDelete(schema_1, command)); }
public void CanEnable_should_not_throw_exception_if_disabled() { var command = new EnableField { FieldId = 1 }; var schema_1 = schema_0.DisableField(1); GuardSchemaField.CanEnable(schema_1, command); }
public void CanShow_should_not_throw_exception_if_hidden() { var command = new ShowField { FieldId = 1 }; var schema_1 = schema_0.HideField(1); GuardSchemaField.CanShow(schema_1, command); }
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 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_properties_not_valid() { var command = new UpdateField { FieldId = 2, Properties = new StringFieldProperties { MinLength = 10, MaxLength = 5 } }; Assert.Throws <ValidationException>(() => GuardSchemaField.CanUpdate(schema_0, command)); }
public void CanUpdate_should_throw_exception_if_marking_a_ui_field_as_list_field() { var command = new UpdateField { FieldId = 4, Properties = new UIFieldProperties { IsListField = true } }; ValidationAssert.Throws(() => GuardSchemaField.CanUpdate(schema_0, command), new ValidationError("UI field cannot be a list field.", "Properties.IsListField")); }
public void CanAdd_should_throw_exception_if_creating_a_ui_field_as_list_field() { var command = new AddField { Name = "field5", Properties = new UIFieldProperties { IsListField = true } }; ValidationAssert.Throws(() => GuardSchemaField.CanAdd(schema_0, command), new ValidationError("UI field cannot be a list field.", "Properties.IsListField")); }
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")); }