Skip to content

Allow setting property names comparer in DeepEqual.System.Text.Json #58

Description

@mariusz96

I would like to have an option for these two to equal:

using DeepEqual;
using DeepEqual.Syntax;
using DeepEqual.SystemTextJson;
using System.Text.Json;

var object1 = JsonDocument.Parse("""{"Object":{"Property":1}}""");
var object2 = JsonDocument.Parse("""{"object":{"property":1}}""");

var comparison = new ComparisonBuilder()
    .UseSystemTextJson()
    .Create();

bool result = object1.IsDeepEqual(object2, comparison);

object1.ShouldDeepEqual(object2, comparison);

It would likely need to be implemented here:

var properties1 = leftValue.EnumerateObject().ToDictionary(x => x.Name);
var properties2 = rightValue.EnumerateObject().ToDictionary(x => x.Name);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions