[Feature]: Add more Dictionary assertions (original) (raw)

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