public void CanAdd_should_not_throw_exception_if_field_not_exists() { var command = new AddField { Name = "field4", Properties = validProperties }; GuardSchemaField.CanAdd(schema_0, command); }
public void CanAdd_should_throw_exception_if_parent_not_exists() { var command = new AddField { Name = "field302", Properties = validProperties, ParentFieldId = 99 }; Assert.Throws <DomainObjectNotFoundException>(() => GuardSchemaField.CanAdd(schema_0, command)); }
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 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")); }