Esempio n. 1
0
        public void CanAdd_should_not_throw_exception_if_field_exists_in_root()
        {
            var command = new AddField {
                Name = "field1", Properties = validProperties, ParentFieldId = 3
            };

            GuardSchemaField.CanAdd(command, schema_0);
        }
Esempio n. 2
0
        public void CanAdd_should_not_throw_exception_if_field_not_exists()
        {
            var command = new AddField {
                Name = "field5", Properties = validProperties
            };

            GuardSchemaField.CanAdd(command, schema_0);
        }
Esempio n. 3
0
        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(command, schema_0));
        }
        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."));
        }