public async Task GivenErrorLogEventHandler_WhenHandleCalledWithCorrectData_ShouldCallErrorLogRepository() { const string userId = "101001"; const string message = "test error message"; var mockErrorLogRepository = Substitute.For <IErrorLogRepository>(); var errorLogEvent = new ErrorLogEvent(userId, message); var errorLogEventHandler = new ErrorLogEventHandler(mockErrorLogRepository); await errorLogEventHandler.Handle(errorLogEvent); await mockErrorLogRepository.Received().SaveErrorLog(Arg.Any <ErrorLog>()); }
private static void Show(Control obj, string title, string msg, MessageBoxIcon icon, bool iError) { if (icon == MessageBoxIcon.Error && iError && ErrorLogEvent != null) { ErrorLogEvent.Invoke(msg); return; } if (obj == null || !obj.Visible || obj.IsDisposed) { MessageBox.Show(msg, title, MessageBoxButtons.OK, icon); } else { Win32Helper.SwitchToThisWindow(obj.Handle, true); MessageBox.Show(obj, msg, title, MessageBoxButtons.OK, icon); } }