Skip to content

feat: add exception property assertions (StackTrace, Data, HResult) #4873

@thomhurst

Description

@thomhurst

Description

Exception assertions currently support Message and InnerException validation, but lack:

  • StackTrace content validation
  • HResult validation
  • Data dictionary content validation
  • Full fluent chaining for exception property assertions

Why

Testing exception behavior often requires validating that the stack trace points to the right location or data is properly attached.

Suggested Approach

.Throws<MyException>()
  .And.HasMessage(msg => msg.Contains("..."))
  .And.HasStackTrace(st => st.Contains("MethodName"))
  .And.WithData(dict => dict.ContainsKey("ErrorCode"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions