本文整理汇总了C#中SqlExecutor.SetUpDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# SqlExecutor.SetUpDatabase方法的具体用法?C# SqlExecutor.SetUpDatabase怎么用?C# SqlExecutor.SetUpDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlExecutor
的用法示例。
在下文中一共展示了SqlExecutor.SetUpDatabase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BadlyFormedQueriesCauseFailedResult
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));
}
示例2: EmptyQueriesCauseFailedResult
public void EmptyQueriesCauseFailedResult()
{
var application = new SqlExecutor(m_SqlServerConfiguration);
application.SetUpDatabase(" ");
var result = application.ExecuteQuery("");
Assert.Equal("Query is empty", ExpectError(result));
}
示例3: SetUpRunsCreationSql
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));
}
示例4: AssertDisplayValue
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));
}
示例5: ExecuteSqlOnBlankDatabase
private QueryResultTable ExecuteSqlOnBlankDatabase(string sql)
{
var application = new SqlExecutor(m_SqlServerConfiguration);
application.SetUpDatabase(" ");
return application.ExecuteQuery(sql).ExpectSuccess();
}