public void BadlyFormedQueriesCauseFailedResult() { var application = new SqlExecutor(m_SqlServerConfiguration); application.SetUpDatabase(" "); var result = application.ExecuteQuery("SELECTEROO"); Assert.Equal("Could not find stored procedure 'SELECTEROO'.", ExpectError(result)); }
public void EmptyQueriesCauseFailedResult() { var application = new SqlExecutor(m_SqlServerConfiguration); application.SetUpDatabase(" "); var result = application.ExecuteQuery(""); Assert.Equal("Query is empty", ExpectError(result)); }
public void SetUpRunsCreationSql() { var creationSql = @" CREATE TABLE JustTesting ( Id INT IDENTITY NOT NULL, Answer INT NOT null ) INSERT INTO JustTesting (Answer) VALUES (42) "; var application = new SqlExecutor(m_SqlServerConfiguration); application.SetUpDatabase(creationSql); var result = application.ExecuteQuery("SELECT Answer FROM JustTesting").ExpectSuccess(); Assert.Equal(42, result.Rows[0].ValueAtIndex<int>(0)); }
private void AssertDisplayValue(string sqlType, string sqlValue, string expectedDisplayValue) { var creationSqlTemplate = @" CREATE TABLE JustTesting ( Id INT IDENTITY NOT NULL, Answer {0} NOT null ) INSERT INTO JustTesting (Answer) VALUES ({1}) "; var creationSql = string.Format(creationSqlTemplate, sqlType, sqlValue); var application = new SqlExecutor(m_SqlServerConfiguration); application.SetUpDatabase(creationSql); var result = application.ExecuteQuery("SELECT Answer FROM JustTesting").ExpectSuccess(); Assert.Equal(expectedDisplayValue, result.Rows[0].DisplayValueAtIndex(0)); }
private QueryResultTable ExecuteSqlOnBlankDatabase(string sql) { var application = new SqlExecutor(m_SqlServerConfiguration); application.SetUpDatabase(" "); return application.ExecuteQuery(sql).ExpectSuccess(); }