public void ShowExceptionDialog_Expected_WindowManagerInvokedForViewModel() { var vm = new ExceptionViewModel(); Mock<IWindowManager> mockWinManager = new Mock<IWindowManager>(); mockWinManager.Setup(c => c.ShowDialog(It.IsAny<BaseViewModel>(), null, null)).Verifiable(); vm.WindowNavigation = mockWinManager.Object; vm.Show(); mockWinManager.Verify(mgr => mgr.ShowDialog(It.IsAny<ExceptionViewModel>(), null, null), Times.Once()); }
/// <summary> /// Creates the exception view model. /// </summary> /// <param name="e">The exception for this viewmodel.</param> /// <param name="environmentModel">The environment model.</param> /// <param name="isCritical">The severity of the error.</param> /// <returns></returns> /// <date>2013/01/16</date> /// <author> /// Jurie.smit /// </author> public static IExceptionViewModel CreateViewModel(Exception e, IEnvironmentModel environmentModel, ErrorSeverity isCritical = ErrorSeverity.Default) { // PBI 9598 - 2013.06.10 - TWR : added environmentModel parameter var vm = new ExceptionViewModel { OutputText = CreateStringValue(e, null, true).ToString(), StackTrace = e.StackTrace, OutputPath = GetUniqueOutputPath(".txt"), DisplayName = isCritical == ErrorSeverity.Critical ? StringResources.CritErrorTitle : StringResources.ErrorTitle, }; var attachedFiles = new Dictionary<string, string>(); vm.Exception.Clear(); vm.Exception.Add(Create(e, isCritical == ErrorSeverity.Critical)); return vm; }