Exemplo n.º 1
0
        protected void Application_Error(object sender, EventArgs e)
        {
            var ex = Server.GetLastError().GetBaseException();
            var errorHandlingSerivce = new ErrorHandlingService();

            errorHandlingSerivce.LogToErrorTable(ex, Request.RawUrl);
            errorHandlingSerivce.LogToErrorLog(ex, Request.RawUrl);
            errorHandlingSerivce.LogToEventViewer(ex, Request.Url.AbsoluteUri, Request.QueryString.ToString());
        }
        public void LogToErrorLog_HandlesError()
        {
            //Arrange
            var helper = new Mock <IHelper>();

            helper.Setup(h => h.GetServicesManager().CreateProxy <IRSAPIClient>(ExecutionIdentity.System))
            .Throws(new Exception("error"));

            //Act
            var srv    = new ErrorHandlingService(helper.Object);
            var result = srv.LogToErrorLog(new Exception("Problems"), "http://localhost/relativity");

            //Assert
            Assert.That(result, Is.False);
        }