Пример #1
0
        public void CanUpdate_should_not_throw_exception_if_not_locked()
        {
            var command = new UpdateField {
                FieldId = 1, Properties = validProperties
            };

            GuardSchemaField.CanUpdate(command, schema_0);
        }
Пример #2
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"));
        }
Пример #3
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));
        }
Пример #4
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"));
        }