public void HandleSaveCommand() { Logger.Debug("Saving settings"); view.UpdateModel(); view.Model.StoreSettings(); LoggerFactory.MinLogLevel = view.Model.MinLogLevel; try { EventDispatcher.Notify(this, new ModelChangedArgs(EventReceiver.OptionsView, EventContext.V1SettingsChanged)); } catch (DataLayerException ex) { var message = string.Format("Settings are invalid or V1 server inaccessible ({0}).", ex.Message); Logger.Error(message, ex); view.ShowErrorMessage(message, "Verification failed"); } }
public void SaveFailure() { Expect.Call(viewMock.Controller).PropertyBehavior().IgnoreArguments(); Expect.Call(viewMock.Model).PropertyBehavior().IgnoreArguments(); Expect.Call(() => eventDispatcherMock.ModelChanged += null).IgnoreArguments(); Expect.Call(viewMock.UpdateModel); Expect.Call(() => eventDispatcherMock.Notify(this, null)).IgnoreArguments().Throw(new DataLayerException(null)); Expect.Call(() => viewMock.ShowErrorMessage(null, null)).IgnoreArguments(); MockRepository.ReplayAll(); controller.RegisterView(viewMock); controller.PrepareView(); controller.Prepare(); controller.HandleSaveCommand(); MockRepository.VerifyAll(); }