• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: NUnit Throws Constraint how to assert object’s value in a list?

Resolved: NUnit Throws Constraint how to assert object’s value in a list?

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

my exception class has a List, contain multiple error messages like this:
in my unit test, I want to assert my exception object like this:
How can I assert the exception contains ValidationErrors with Description “missing field 2”? What I am trying to do like this (but failed)

Answer:

For the sake of clarity, I would split the assertion that a specific exception has been thrown from the assertions of its properties:

If you have better answer, please add a comment about this, thank you!

c# nunit nunit-3.0 unit-testing
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: what are the permissions required to assign a resource monitor to a warehouse?

01/04/2023

Resolved: How can I modify formData before sending it?

01/04/2023

Resolved: How to efficient create SimpleITK image?

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.