Skip to main content

Unit Tests

You can use the Moq and NUnit frameworks to test your XAF application. Unlike the approach with EasyTest, this one does not require an XAF application or Object Space instances and Types Info Subsystem. This topic lists ways to test different parts of an XAF application.

  1. Test Action’s enabled/disabled state based on user permissions
  2. Test whether object property changes using Actions were successfully committed
  3. Test object queries by criteria and Detail View creation
  4. Test event handlers in Controllers
  5. Test New Action custom business logic based on parent and nested Views
  6. Test the Action’s enabled/disabled state based on target criteria and selection dependency types in List View
  7. Test the Action’s enabled/disabled state based on target criteria and selection dependency types in Detail View
  8. Test localized strings from CaptionHelper (Approach 1)
  9. Test localized strings from CaptionHelper (Approach 2)
  10. Test custom logic in XAF/XPO business classes

Refer to the following article for more information on APIs used in these examples: How to write lightweight unit tests for XAF Actions, Controllers and other custom UI logic.