Ejemplo n.º 1
0
        public static void Ctor_GivenChecksWithNullValue_ThrowsArgumentNullException()
        {
            Identifier tableName  = "test_table";
            var        columns    = new[] { Mock.Of <IDatabaseColumn>() };
            var        primaryKey = Option <IDatabaseKey> .None;
            var        uniqueKeys = Array.Empty <IDatabaseKey>();
            var        parentKeys = Array.Empty <IDatabaseRelationalKey>();
            var        childKeys  = Array.Empty <IDatabaseRelationalKey>();
            var        indexes    = Array.Empty <IDatabaseIndex>();
            var        checks     = new IDatabaseCheckConstraint[] { null };
            var        triggers   = Array.Empty <IDatabaseTrigger>();

            Assert.That(() => new RelationalDatabaseTable(tableName, columns, primaryKey, uniqueKeys, parentKeys, childKeys, indexes, checks, triggers), Throws.ArgumentNullException);
        }
Ejemplo n.º 2
0
        public Constraints.CheckConstraint MapCheckConstraint(Identifier tableName, IDatabaseCheckConstraint check)
        {
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }
            if (check == null)
            {
                throw new ArgumentNullException(nameof(check));
            }

            var constraintName = check.Name.Match(name => name.LocalName, () => string.Empty);

            return(new Constraints.CheckConstraint(
                       tableName,
                       constraintName,
                       check.Definition
                       ));
        }