Beispiel #1
0
        public void CanUpdate_should_not_throw_exception_if_not_locked()
        {
            var command = new UpdateField {
                FieldId = 1, Properties = new StringFieldProperties()
            };

            GuardSchemaField.CanUpdate(schema_0, command);
        }
Beispiel #2
0
        public void CanUpdate_should_not_throw_exception_if_not_locked()
        {
            var command = new UpdateField {
                FieldId = 1, Properties = validProperties
            };

            GuardSchemaField.CanUpdate(command, schema_0);
        }
        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));
        }
Beispiel #4
0
        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"));
        }
Beispiel #5
0
        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));
        }
Beispiel #6
0
        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 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));
        }
Beispiel #8
0
        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"));
        }
Beispiel #9
0
        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"));
        }