/// <summary>
 /// Initializes a new instance of the <see cref="ComparisonTemplatorTests"/> class. Test the
 /// <see cref="ComparisonTemplator"/> using a single sql for test and assert. It should be
 /// OK that we compare the same sql to itself because that doens't really add to the
 /// complexity of the templator's work.
 /// </summary>
 public ComparisonTemplatorTests(ParseResultValue parseResult, string comment, string sql, List <string> columns)
 {
     this.parseResult  = parseResult;
     this.comment      = comment;
     this.sql          = sql;
     this.columns      = columns;
     this.actualResult = ComparableSqlParser.ParseAndValidate(sql);
 }
Exemplo n.º 2
0
 public ParsedSql(string sql, ParseResultValue parseResult, string validationMessage)
     : this(sql, parseResult, validationMessage, new List <string>(), default)
 {
     if (parseResult == ParseResultValue.Valid)
     {
         throw new ArgumentException("Valid parsed sql must supply columns");
     }
 }
Exemplo n.º 3
0
 public ParsedSql(string sql, ParseResultValue parseResult, string validationMessage, List <string> columnNames, int intoIndex)
 {
     this.columnNames = columnNames ?? throw new ArgumentNullException(nameof(columnNames));
     Sql               = sql ?? throw new ArgumentNullException(nameof(sql));
     ParseResult       = parseResult;
     ValidationMessage = validationMessage ?? throw new ArgumentNullException(nameof(validationMessage));
     IntoIndex         = intoIndex;
 }
Exemplo n.º 4
0
        public void GetSqlWithInto_InvalidValidSql_Throws(ParseResultValue parseResult)
        {
            var sut = new ParsedSql("Sql string", parseResult, string.Empty);

            Assert.Throws <InvalidOperationException>(() => sut.GetSqlWithInto("#T"));
        }