Skip to content

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

@mariusz96

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);

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