Example #1
0
        public void ForeignKeyValidationTest()
        {
            storage.Validate();

            var foreignKey = new ForeignKeyInfo(referencingTable, "ForeignKey");

            AssertEx.Throws <AggregateException>(foreignKey.Validate);
            foreignKey.PrimaryKey = foreignPrimary;
            AssertEx.Throws <AggregateException>(foreignKey.Validate);

            foreignKey.ForeignKeyColumns.Set(invalideReferencingIndex);
            AssertEx.Throws <AggregateException>(foreignKey.Validate);
            foreignKey.ForeignKeyColumns.Set(referencingIndex);
            foreignKey.Validate();
        }