public static async Task AnalyseViews_GivenViewWithColumnNameContainingReservedKeyword_ProducesMessages() { var rule = new ReservedKeywordNameRule(CreateFakeDialect(), RuleLevel.Error); var viewName = new Identifier("test"); var testColumn = new DatabaseColumn( "SELECT", Mock.Of <IDbType>(), false, null, null ); var view = new DatabaseView( viewName, "select 1", new List <IDatabaseColumn> { testColumn } ); var views = new[] { view }; var hasMessages = await rule.AnalyseViews(views).AnyAsync().ConfigureAwait(false); Assert.That(hasMessages, Is.True); }
public static async Task AnalyseViews_GivenViewWithNameContainingReservedKeyword_ProducesMessages() { var rule = new ReservedKeywordNameRule(CreateFakeDialect(), RuleLevel.Error); var viewName = new Identifier("SELECT"); var view = new DatabaseView( viewName, "select 1", Array.Empty <IDatabaseColumn>() ); var views = new[] { view }; var hasMessages = await rule.AnalyseViews(views).AnyAsync().ConfigureAwait(false); Assert.That(hasMessages, Is.True); }
public static void AnalyseViews_GivenNullViews_ThrowsArgumentNullException() { var rule = new ReservedKeywordNameRule(CreateFakeDialect(), RuleLevel.Error); Assert.That(() => rule.AnalyseViews(null), Throws.ArgumentNullException); }