Exemple #1
0
        public static async Task AnalyseTables_GivenTableWithOneColumn_ProducesMessages()
        {
            var rule = new OnlyOneColumnPresentRule(RuleLevel.Error);

            var testColumn = new DatabaseColumn(
                "test_column",
                Mock.Of <IDbType>(),
                true,
                null,
                null
                );

            var table = new RelationalDatabaseTable(
                "test",
                new List <IDatabaseColumn> {
                testColumn
            },
                null,
                Array.Empty <IDatabaseKey>(),
                Array.Empty <IDatabaseRelationalKey>(),
                Array.Empty <IDatabaseRelationalKey>(),
                Array.Empty <IDatabaseIndex>(),
                Array.Empty <IDatabaseCheckConstraint>(),
                Array.Empty <IDatabaseTrigger>()
                );
            var tables = new[] { table };

            var hasMessages = await rule.AnalyseTables(tables).AnyAsync().ConfigureAwait(false);

            Assert.That(hasMessages, Is.True);
        }
Exemple #2
0
        public static void AnalyseTables_GivenNullTables_ThrowsArgumentNullException()
        {
            var rule = new OnlyOneColumnPresentRule(RuleLevel.Error);

            Assert.That(() => rule.AnalyseTables(null), Throws.ArgumentNullException);
        }