Esempio n. 1
0
        public static void GetTable_GivenNullTableName_ThrowsArgNullException()
        {
            var connection         = Mock.Of <ISchematicConnection>();
            var identifierDefaults = Mock.Of <IIdentifierDefaults>();

            var tableProvider = new SqlServerRelationalDatabaseTableProvider(connection, identifierDefaults);

            Assert.That(() => tableProvider.GetTable(null), Throws.ArgumentNullException);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlServerRelationalDatabase"/> class.
        /// </summary>
        /// <param name="connection">A schematic connection.</param>
        /// <param name="identifierDefaults">Database identifier defaults.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connection"/> or <paramref name="identifierDefaults"/> are <c>null</c>.</exception>
        public SqlServerRelationalDatabase(ISchematicConnection connection, IIdentifierDefaults identifierDefaults)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            IdentifierDefaults = identifierDefaults ?? throw new ArgumentNullException(nameof(identifierDefaults));

            _tableProvider    = new SqlServerRelationalDatabaseTableProvider(connection, identifierDefaults);
            _viewProvider     = new SqlServerDatabaseViewProvider(connection, identifierDefaults);
            _sequenceProvider = new SqlServerDatabaseSequenceProvider(connection.DbConnection, identifierDefaults);
            _synonymProvider  = new SqlServerDatabaseSynonymProvider(connection.DbConnection, identifierDefaults);
            _routineProvider  = new SqlServerDatabaseRoutineProvider(connection.DbConnection, identifierDefaults);
        }