Skip to content

[Feature]: Add more Dictionary assertions #6185

Description

@AdrianoAE

Problem Statement

Currently asserting combinations of key and values is awkward and requires multiple steps

await Assert.That(result).ContainsKey("Key");
await Assert.That(result["Key"]).IsEqualTo(1234L);

or

await Assert.That(result).ContainsKey("Key");
await Assert.That(result["Key"].InnerProperty).IsEqualTo(1234L);

Proposed Solution

Allow chaining the value check without requiring accessing the key again

await Assert.That(result).ContainsKey("Key").Value.IsEqualTo(1234L);

or

await Assert.That(result).ContainsKey("Key").Value().Member(x => x.Prop, p => p.IsEqualTo(1234L);

Alternatives Considered

Either with Value or Value(), whatever fits with the rest of the framework

Feature Category

Assertion

How important is this feature to you?

QoL

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions