Search code examples
delphispring4ddunitx

How to use Guard in place of Assert in TestInsight.DUnitX


I want to use the TestInsight.DUnitX with guard (Spring4D) but I get message 'No assertions were made during the test'

Is it possible to use the guard class in place of the assert?


Solution

  • Spring.Guard has nothing to do with Assert from DUnitX.

    If you have unit tests that just pass because Guard (or basically any possible exception throwing code) did not raise then you need to satisfy DUnitX (or more precisely TestInsight) by simply calling Assert.Pass in your unit tests which basically tells it "I did not forget any checks - it's all fine".

    See also https://stackoverflow.com/a/42073187/587106