public void Looking_for_child_accessor_token() { var sql = @"CREATE TABLE 'gameratings_db'.'testtable' ( 'id' bigint(20) DEFAULT NULL, 'test' varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; var scanner = new Scanner(sql); var token = scanner.GetNextToken(4); Assert.IsInstanceOfType(typeof(ChildAccessorToken), token); }
public void Looking_for_column_name_value_token() { var sql = @"CREATE TABLE 'gameratings_db'.'testtable' ( 'id' bigint(20) DEFAULT NULL, 'test' varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; var scanner = new Scanner(sql); var token = scanner.GetNextToken(7); Assert.IsInstanceOfType(typeof(ValueToken), token); Assert.AreEqual( "id", ((ValueToken)token).Value, "The token's value should match the table's column name."); }
public void Looking_for_varchar_data_type_token() { var sql = @"CREATE TABLE 'gameratings_db'.'testtable' ( 'id' bigint(20) DEFAULT NULL, 'test' varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; var scanner = new Scanner(sql); var token = scanner.GetNextToken(16); Assert.IsInstanceOfType(typeof(OptionToken), token); Assert.AreEqual( "varchar", ((OptionToken)token).Value, "The token's value should match the default option's value."); }
public void Looking_for_end_of_statement_token() { var sql = @"CREATE TABLE 'gameratings_db'.'testtable' ( 'id' bigint(20) DEFAULT NULL, 'test' varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; var scanner = new Scanner(sql); var token = scanner.GetNextToken(30); Assert.IsInstanceOfType(typeof(EndOfStatementToken), token); }