Open jakubozga opened 7 years ago
Was that BeEquivalentTo(...)
provided by the FluentAssertions.Json package or the core library?
Hi,
Decided to try out your library, and hit the same issue reported by @jakubozga . In my case:
BeEquivalentTo(...)
operation is provided by FluentAssertions.Json package, JTokenAssertions
classStack Trace:
at System.Text.StringBuilder.FormatError() at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args) at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args) at System.String.Format(String format, Object[] args) at FluentAssertions.Execution.MessageBuilder.FormatArgumentPlaceholders(String failureMessage, Object[] failureArgs) at FluentAssertions.Execution.MessageBuilder.Build(String message, Object[] messageArgs, String reason, ContextDataItems contextData) at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) at FluentAssertions.Json.JTokenAssertions.BeEquivalentTo(JToken expected, String because, Object[] becauseArgs)
Could it be that your MessageBuilder
class in the original FluentAssertions app is not handling well messages without placeholders?
JSON's BeEquivalentTo
is the only extension method that use FailWith message without placeholders.
Could it be that your MessageBuilder class in the original FluentAssertions app is not handling well messages without placeholders?
Yes, there was a problem in 4.19.3. See https://github.com/fluentassertions/fluentassertions/releases/tag/4.19.3
Using versions: FluentAssertions - v4.19.4 FluentAssertions.Json - v4.20.0
Issue seems to be away with pre-release 5.0.0-beta0002 and 5.0.0-beta0003.
Hmm, I found the fix. Unfortunately, I can't resolve this issue on 4.x. You'll have to wait for 5.0.
@dennisdoomen Guess this could be closed? (V6 is released)
Not sure. Completely lost track of this one.
Hello,
Lately I found that if you have 2 different JTokens and call
Should().BeEquivalentTo(...)
you will get: "System.FormatException: Input string was not in a correct format." instead of error message.My guess is that this exception is caused because code is trying to call
string.Format(JToken)
. JToken contains characters like{
and}
which should be escaped to{{
and}}