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.
- Test Action’s enabled/disabled state based on user permissions
- Test whether object property changes using Actions were successfully committed
- Test object queries by criteria and Detail View creation
- Test event handlers in Controllers
- Test New Action custom business logic based on parent and nested Views
- Test the Action’s enabled/disabled state based on target criteria and selection dependency types in List View
- Test the Action’s enabled/disabled state based on target criteria and selection dependency types in Detail View
- Test localized strings from CaptionHelper (Approach 1)
- Test localized strings from CaptionHelper (Approach 2)
- 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.