public void should_run_exists_command() { var sqlConnection = new SqlConnection(_connectionstring); var sqlServerDriver = new SQLServerDriver(sqlConnection, true); var commandText = "SELECT name FROM master.dbo.sysdatabases " + $" WHERE name = 'master'"; var isExists = sqlServerDriver.Exists(commandText); isExists.Should().BeTrue(); }
public static AndConstraint <StringAssertions> HaveSchema(this StringAssertions assertions, string connectionString) { var dbName = assertions.Subject; SQLServerDriver driver = new SQLServerDriver(new SqlConnection(connectionString)); var command = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'People'"; var isTableCreated = driver.Exists(command); Execute.Assertion.ForCondition(isTableCreated) .FailWith("schema did not create correctly"); return(new AndConstraint <StringAssertions>(assertions)); }