-
-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Description
for example:
public class MyCustomException : Exception
{
public string MyCustomProperty { get; }
public MyCustomException(string myCustomProperty)
{
MyCustomProperty = MyCustomProperty;
}
}when hovering over the property MyCustomProperty I would like to have a suggestion to generate an assertion for that property.
The generated assertion will something like this:
public static class MyCustomExceptionExtensions
{
public static ExceptionAssertions<TException> WithMyCustomProperty<TException>(this ExceptionAssertions<TException> assertions,
string expectedMyCustomProperty, string because = "", params object[] becauseArgs) where TException : MyCustomException
{
Execute.Assertion
.ForCondition(assertions.And.MyCustomProperty.Equals(expectedMyCustomProperty))
.BecauseOf(because, becauseArgs)
.FailWith("Expected exception with MyCustomProperty {0}{reason}, but found {1}.", assertions.And.MyCustomProperty, expectedMyCustomProperty);
return assertions;
}
}