-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for FromSql with DbParameter without name prefix #16362
Conversation
protected override DbParameter CreateDbParameter(string name, object value) | ||
=> new SqliteParameter | ||
{ | ||
ParameterName = name, | ||
Value = value | ||
}; | ||
|
||
private void AssertSql(params string[] expected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed that so far we are not asserting SQL for other FromSql tests against SQLite. I can revert changes to this file if this is by design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We assert SQL in Sqlite provider when we expect it to differ from SQL server. Like different server side functions for date time operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. In this case there aren’t any differences, so I will remove for consistency.
test/EFCore.Relational.Specification.Tests/Query/FromSqlQueryTestBase.cs
Show resolved
Hide resolved
test/EFCore.Relational.Specification.Tests/Query/FromSqlQueryTestBase.cs
Show resolved
Hide resolved
protected override DbParameter CreateDbParameter(string name, object value) | ||
=> new SqliteParameter | ||
{ | ||
ParameterName = name, | ||
Value = value | ||
}; | ||
|
||
private void AssertSql(params string[] expected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We assert SQL in Sqlite provider when we expect it to differ from SQL server. Like different server side functions for date time operations.
New variations of FromSqlRaw and FromSqlInterpolated specification tests take DbParameter without using a prefix in the name. E.g. "city" instead of "@city" and verify that the prefix is added automatically when the parameter name is added in-line in the SQL.
Also added SQL Server
and SQLiteoverrides that assert the SQL.Closes #14173