Esempio 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 LogToEventViewer()
        {
            //Act
            var srv    = new ErrorHandlingService();
            var result = srv.LogToEventViewer(new Exception("Problems"), "http://localhost/relativity", "");

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