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 !
            };

            ValidationAssert.Throws(() => GuardSchemaField.CanUpdate(command, schema_0),
                                    new ValidationError("Properties is required.", "Properties"));
        }
        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 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"));
        }