querybuilder
querybuilder copied to clipboard
Error in test suite
I found an error in the test suite for single/double values, here: https://github.com/sqlkata/querybuilder/blob/422878cd703d75e245e023de89d2ac2ab693f554/QueryBuilder.Tests/ParameterTypeTests.cs#L25 and here: https://github.com/sqlkata/querybuilder/blob/422878cd703d75e245e023de89d2ac2ab693f554/QueryBuilder.Tests/ParameterTypeTests.cs#L27
You convert the string to a Single, using InvariantCulture: OK
After that you convert the Single value to string, using ToString(), but without specifying the culture.
It should be like this:
new object[] {Convert.ToSingle("10.5", CultureInfo.InvariantCulture).ToString(CultureInfo.InvariantCulture), 10.5}
If you run this test on a machine that has a culture with a differente decimal separator like comma, the test would expect the query to be compiled with value "10,5". The query instead compiles correctly with "10.5" and the test fails.
Thanks for reporting, would you mind adding a PR for this?
@mconca-kube I think you opened the merge request on the wrong repository ;)
Just a quick follow up on that: Wouldn't it be sufficient to just check for "10.5" and "-2.8" as a string, since the over complicated construct will always evaluate to these values, right?
Hi there Also found this error, but I think it can be solve like this: new object[] {"10.5", 10.5}, new object[] {"-2.8", -2.8},