Exemple #1
0
        protected TableFormat createTestTableFormat()
        {
            TableFormat format = new TableFormat(1, 1);
            FieldFormat ff     = FieldFormat.create("name", FieldFormat.STRING_FIELD, "name", "default name");

            ff.addValidator(NAME_SYNTAX_VALIDATOR);
            format.addField(ff);
            format.addField(FieldFormat.create("dt", FieldFormat.DATATABLE_FIELD, "dt", new DataTable()));
            format.addField(FieldFormat.create("float", FieldFormat.FLOAT_FIELD, "float", 1.5f));
            format.setReorderable(true);
            return(format);
        }
        public void testEquals()
        {
            FieldFormat ff1 = FieldFormat.create("<value><I><A=0>");

            ff1.addValidator(new LimitsValidator(5, 10));

            TableFormat tf1 = ff1.wrap();

            tf1.addRecordValidator(new KeyFieldsValidator());
            tf1.addTableValidator(new TableKeyFieldsValidator());

            FieldFormat ff2 = FieldFormat.create("<value><I><A=0>");

            ff2.addValidator(new LimitsValidator(5, 10));

            TableFormat tf2 = ff2.wrap();

            tf2.addRecordValidator(new KeyFieldsValidator());
            tf2.addTableValidator(new TableKeyFieldsValidator());


            Assert.AreEqual(tf1, tf2);
            Assert.AreEqual(tf1.GetHashCode(), tf2.GetHashCode());
        }