just in case someone experiences issues with decimal numbers while using AsserThat.
I have found an interessting behaviour of the used parser when using mixed type values in a mathematical formula.
When mixing int/decimal? the calculation returns a wrong result:
Parser.Parse<double>(validationContextType, "MyValue * 4300").Invoke(new MyClass(){ MyValue = 1.2 }) == 4300 // should be 5160
Replacing the int by a number with a decimal place, the parser works as expected.
Parser.Parse<double>(validationContextType, "MyValue * 4300.0").Invoke(new MyClass(){ MyValue = 1.2 }) == 5160
For constants just add ".0"
[AssertThat("Value1<= Value2 * 4380.0",..)]
Hi,
just in case someone experiences issues with decimal numbers while using AsserThat.
I have found an interessting behaviour of the used parser when using mixed type values in a mathematical formula.
When mixing
int
/decimal?
the calculation returns a wrong result:Parser.Parse<double>(validationContextType, "MyValue * 4300").Invoke(new MyClass(){ MyValue = 1.2 }) == 4300 // should be 5160
Replacing the int by a number with a decimal place, the parser works as expected.
Parser.Parse<double>(validationContextType, "MyValue * 4300.0").Invoke(new MyClass(){ MyValue = 1.2 }) == 5160
For constants just add ".0"
[AssertThat("Value1<= Value2 * 4380.0",..)]
I hope this helps someone.