public void Test_Should_Generate_InlineUpdate() { var cmd = new OracleCommand("update TEST_USER.person SET first_name=@param1 where last_name=@whereparam1", null); cmd.Parameters.Add(new OracleParameter("@param1", "Charlotte")); cmd.Parameters.Add(new OracleParameter("@whereparam1", "Saunders")); cmd.CommandType = CommandType.Text; var expectedSQl = "update TEST_USER.person SET first_name=N'Charlotte' where last_name=N'Saunders'"; var sqlCommandStringBuilder = new OracleSqlCommandStringBuilder(); var result = sqlCommandStringBuilder.GetCommandTextInline(cmd); Assert.NotEmpty(result); Assert.Equal(expectedSQl.Replace("\n", "").Replace("\r", ""), result.Replace("\n", "").Replace("\r", "")); }
public void Test_Should_Generate_SQL() { var cmd = new OracleCommand("GetEntity", null); cmd.Parameters.Add(new OracleParameter("@foobar", 1)); cmd.Parameters.Add(new OracleParameter() { ParameterName = "@outParam", Direction = ParameterDirection.Output, OracleDbType = OracleDbType.Int32 }); cmd.Parameters.Add(new OracleParameter() { Direction = ParameterDirection.ReturnValue }); cmd.CommandType = CommandType.StoredProcedure; var sqlCommandStringBuilder = new OracleSqlCommandStringBuilder(); var sql = sqlCommandStringBuilder.GetCommandText(cmd); Assert.NotEmpty(sql); }