Skip to content

[NUnit2057] Reported for Throws assert #945

@MaceWindu

Description

@MaceWindu

Version 4.11.1 (no reports in 4.11.0)

From rule description I expect such asserts not rise analyzer warning, but probably something doesn't work as expected.

Some examples where I have it:

Assert.That(() =>
{
    ...
}, Throws.InstanceOf<ArgumentOutOfRangeException>().With.Property(nameof(ArgumentOutOfRangeException.ParamName)).EqualTo("exponentialBase"));

Assert.That(
				() => db.GetTable<Child>().ToList(),
				Throws.TypeOf<ArgumentException>()
					.Or.TypeOf<InvalidOperationException>()
					.Or.TypeOf<MySqlException>());


Assert.That(() => query.ToList(), Throws.InvalidOperationException.With.Message.EqualTo("Cannot construct object 'Tests.Linq.EagerLoadingTests+EntityA'. Following members are not assignable: ObjectBRO."));

As all reports are quite complex, I suspect analyzer ignores only simple Throws expressions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions