I am looking for the best way to verify that a given method (unit) is executing the correct logic.
In this case, I have a method similar to:
public void GoToMyPage()
{
DispatcherHelper.BeginInvoke(() =>
{
navigationService.Navigate("mypage.xaml", "id", id);
});
}
navigationService- it is injected interface version INavigationService. Now, I want to check in my unit tests what Navigate(...)is being called with the correct parameters.
However, on Windows Phone, IL-radiation is not supported to some extent, when the mocking structure can create a dynamic proxy server and analyze the call. So I need to analyze this manually.
A simple solution would be to store the values invoked by the method Navigate(...)in public properties and test them in unit tests. However, this is pretty tedious of what needs to be done for all kinds of layouts and methods.
So my question is: is there a smarter way to create analytic calls using C # functions (such as delegates), without using a reflection-based proxy and without having to manually save debugging information?
source
share