C# - WPF : testing strategies

前端 未结 5 1994
情书的邮戳
情书的邮戳 2021-02-03 12:22

I\'m new to C# 4.0 and WPF and I\'m about to start a new application.

Coming from a C++/MFC world, I\'m interested in testing strategies used with the up to date technol

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-03 13:08

    As already mentioned, the MVVM pattern (or even the Model-View-ViewModel-Presenter pattern) is a good start. They allow you to separately and isolated test the different concerns of the application.

    A good tool for the unit testing part is Moq . I use it a lot.

    I also do often acceptance tests from the ViewModel down to the Model and Presenter. So I can assure that all layers work together. This is a compromise between UI testing and unit testing. It has the advantage that the tests run faster and therefore are run more often.

    If you also want to automatically test the correct data binding between the View and the ViewModel you should check out Guia. It allows you to directly instantiate and test a single UserControl.

提交回复
热议问题