public static void Ctor_GivenNullIdentifierDefaults_ThrowsArgNullException()
        {
            var connection         = Mock.Of <IDbConnectionFactory>();
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            Assert.That(() => new PostgreSqlRoutineCommentProvider(connection, null, identifierResolver), Throws.ArgumentNullException);
        }
        public static void Ctor_GivenNullConnection_ThrowsArgNullException()
        {
            var identifierDefaults = Mock.Of <IIdentifierDefaults>();
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            Assert.That(() => new PostgreSqlDatabaseCommentProvider(null, identifierDefaults, identifierResolver), Throws.ArgumentNullException);
        }
        public static void Ctor_GivenNullIdentifierDefaults_ThrowsArgumentNullException()
        {
            var connection         = Mock.Of <ISchematicConnection>();
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            Assert.That(() => new PostgreSqlRelationalDatabase(connection, null, identifierResolver), Throws.ArgumentNullException);
        }
        public static void GetResolutionOrder_GivenUppercaseSchemaIdentifier_ReturnsTwoIdentifiers()
        {
            var input = new Identifier("a", "b", "C", "d");
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            var result = identifierResolver.GetResolutionOrder(input).ToList();

            Assert.That(result, Has.Exactly(2).Items);
        }
        public static void GetResolutionOrder_GivenUppercaseDatabaseIdentifier_ReturnsOneIdentifier()
        {
            var input = new Identifier("a", "B", "c", "d");
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            var result = identifierResolver.GetResolutionOrder(input).ToList();

            Assert.That(result, Has.Exactly(1).Items);
        }
        public static void GetResolutionOrder_GivenUppercaseServerIdentifier_ReturnsIdentifierEqualToInput()
        {
            var input = new Identifier("A", "b", "c", "d");
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            var result = identifierResolver.GetResolutionOrder(input).ToList();

            Assert.That(result[0], Is.EqualTo(input));
        }
        public static void GetRoutineComments_GivenNullRoutineName_ThrowsArgNullException()
        {
            var connection         = Mock.Of <IDbConnectionFactory>();
            var identifierDefaults = Mock.Of <IIdentifierDefaults>();
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            var commentProvider = new PostgreSqlDatabaseCommentProvider(connection, identifierDefaults, identifierResolver);

            Assert.That(() => commentProvider.GetRoutineComments(null), Throws.ArgumentNullException);
        }
        public static void GetResolutionOrder_GivenUppercaseDatabaseIdentifier_ReturnsLowercasedIdentifier()
        {
            var input              = new Identifier("a", "B", "c", "d");
            var expectedResults    = new[] { new Identifier("a", "b", "c", "d") };
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            var result = identifierResolver.GetResolutionOrder(input).ToList();

            Assert.That(result, Is.EqualTo(expectedResults));
        }
        public static void GetResolutionOrder_GivenUppercaseSchemaAndLocalNameIdentifier_ReturnsExpectedResults()
        {
            var input           = new Identifier("a", "b", "C", "D");
            var expectedResults = new[]
            {
                new Identifier("a", "b", "c", "d"),
                new Identifier("a", "b", "c", "D"),
                new Identifier("a", "b", "C", "d"),
                input
            };
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            var result = identifierResolver.GetResolutionOrder(input).ToList();

            Assert.That(result, Is.EqualTo(expectedResults));
        }
        public static void GetResolutionOrder_GivenNullIdentifier_ThrowsArgumentNullException()
        {
            var identifierResolver = new DefaultPostgreSqlIdentifierResolutionStrategy();

            Assert.That(() => identifierResolver.GetResolutionOrder(null), Throws.ArgumentNullException);
        }