Skip to content

Should().BeEquivalentTo() throws FormatException #32

@znakeeye

Description

@znakeeye

Using FluentAssertions.Json 5.3.0 with Newtonsoft.Json.12.0.3. Targeting .NET Framework 4.7.2.

var foo = JObject.Parse(File.ReadAllText(@"foo.json"));
var bar = JObject.Parse(File.ReadAllText(@"bar.json"));
foo.Should().BeEquivalentTo(bar); // Throws FormatException :(

foo.json

{
  "{EDBAC3EA}": {
    "abc": [
      "a",
      "b",
      "c"
    ]
  }
}

bar.json

{
  "{EDBAC3EA}": {
    "abc": [
      "a",
      "b"
    ]
  }
}

Unhandled Exception: System.FormatException: Input string was not in a correct format.
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) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\MessageBuilder.cs:line 87
at FluentAssertions.Execution.MessageBuilder.Build(String message, Object[] messageArgs, String reason, ContextDataItems contextData, String identifier, String fallbackIdentifier) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\MessageBuilder.cs:line 36
at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 208
at FluentAssertions.Json.JTokenAssertions.BeEquivalentTo(JToken expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-json-j8c2b\Src\FluentAssertions.Json\JTokenAssertions.cs:line 89

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions