Beispiel #1
0
    public static void Model_IsNotValid_WithNoKeyFields()
    {
        var model = new Model("Test");

        var sut    = new ModelValidator();
        var result = sut.TestValidate(model);

        result.ShouldHaveValidationErrorFor(m => m.Key.Fields);
    }
Beispiel #2
0
    public static void Model_IsNotValid_WithDuplicateFields()
    {
        var model = new Model("Test");

        model.Fields.Add(new Field("Field1"));
        model.Fields.Add(new Field("Field1"));

        var sut    = new ModelValidator();
        var result = sut.TestValidate(model);

        result.ShouldHaveValidationErrorFor(m => m.Fields);
    }
Beispiel #3
0
    public static void Model_IsNotValid_WithIndexFieldsThatAreNotThere()
    {
        var model = new Model("Test");

        var idx = new Index();

        idx.Fields.Add(new IndexField("IDX_Field"));
        model.Indexes.Add(idx);

        var sut    = new ModelValidator();
        var result = sut.TestValidate(model);

        result.ShouldHaveValidationErrorFor(m => m.Indexes);
    }
Beispiel #4
0
    public static void Model_IsNotValid_WithAuditFieldsAndHasAudit()
    {
        var model = new Model("Test");

        model.Fields.Add(new Field("Created"));
        model.Fields.Add(new Field("Modified"));
        model.Fields.Add(new Field("CreatedBy"));
        model.Fields.Add(new Field("ModifiedBy"));

        var sut    = new ModelValidator();
        var result = sut.TestValidate(model);

        result.ShouldHaveValidationErrorFor(m => m.HasAudit);
    }
Beispiel #5
0
    public static void Model_IsNotValid_With2BusinessKeys()
    {
        var model = new Model("Test");

        model.Fields.Add(new Field("Field1")
        {
            BusinessKey = true
        });
        model.Fields.Add(new Field("Field2")
        {
            BusinessKey = true
        });

        var sut    = new ModelValidator();
        var result = sut.TestValidate(model);

        result.ShouldHaveValidationErrorFor(m => m.Fields);
    }