Как написать методы модульного тестирования формы MVVM pattern WPF viewmodel классов?
I am not able to mock the navigationcontext using moq framework. Can anyone help on this Constructor -------------- public CreateQuestionsViewModel(IEventAggregator eventAggregator, IUnityContainer unityContainer) : base(eventAggregator, unityContainer) { FrameWorkManager.Log(DisplayMessages.msgBoxInitrCreateViewModelLog); Initialize(); } Method --------- public override void OnNavigatedTo(NavigationContext navigationContext) { try { using (new WaitCursor()) { if (navigationContext.NavigationService.Region.Context != null) { if (navigationContext.NavigationService.Region.Context is QuestionDTO question) { if (navigationContext.Parameters[Constants.ISUSEREDITING_QUESTION] != null) { _IsQuestionEditing = (bool)navigationContext.Parameters[Constants.ISUSEREDITING_QUESTION]; } if (navigationContext.Parameters[Constants.ISUSERCLONING_QUESTION] != null) { _IsQuestionCloning = (bool)navigationContext.Parameters[Constants.ISUSERCLONING_QUESTION]; CloneQuestionCommand.RaiseCanExecuteChanged(); } LoadQuestionForCloningOrEditing(question); } EnableDisableSavePreviewButtons(); } else _AddNewQuestionInstance = true; } } catch (Exception ex) { FrameWorkManager.PublishException(ex); MessageBoxService.Show(DisplayMessages.strErrorLoadingQuestion, DisplayMessages.msgBoxErrorCaption, DXMVVM.MessageButton.OK, DXMVVM.MessageIcon.Error, DXMVVM.MessageResult.OK); } } Below are the other methods name inside the viewmodel public override void OnNavigatedFrom(NavigationContext navigationContext) public override void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
Что я уже пробовал:
Я попробовал использовать moq framework для написания методов модульного тестирования