Skip to content

Return value from Assert.That overload with delegate #3421

Open
@Dreamescaper

Description

It would be very convenient to have Assert.That overload accepting ActualValueDelegate<TActual> to return TActual value, with which assert passed.

Scenario, which happens for me quite often. I need to wait for some value (e.g. from rest service), and than assert it.

Currently I do something like that:

ActualType actual = null;
Assert.That(() => actual = getActual(), Is.Not.Null.After(5000, 100));

Assert.That(actual...);

Would be much nicer to have like that:

var actual = Assert.That(getActual, Is.Not.Null.After(...));
...

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions