Пример #1
0
        public void VerifyErrorLogWriteTest()
        {
            string expectedMessage = "Record # in etblErrorLog = ";
            startTime = DateTime.Now;

            writeRequest = new ErrorLogWriteRequestDC();
            writeReply = null;

            writeRequest.AppDomainName = string.Empty;
            writeRequest.ErrorGuid = Guid.NewGuid().ToString();
            writeRequest.EventId = 1;
            writeRequest.FormattedMessage = string.Empty;
            writeRequest.MachineName = MACHINE_NAME;
            writeRequest.Message = MESSAGE;
            writeRequest.Priority = 1;
            writeRequest.ProcessId = PROCESS_ID;
            writeRequest.ProcessName = PROCESS_NAME;
            writeRequest.Severity = SEVERITY;
            writeRequest.ThreadName = THREADNAME;
            writeRequest.Timestamp = DateTime.Now;
            writeRequest.Title = TITLE;
            writeRequest.Win32ThreadId = WIN32THREADID;
            writeRequest.IncallerVersion = IN_CALLER_VERSION;
            writeRequest.Incaller = IN_CALLER;

            try
            {
                writeReply = proxy.ErrorLogWrite(writeRequest);
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to write data to etblErrorLog: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to write data to etblErrorLog: {0}", ex.Message);
            }

            Assert.IsNotNull(writeReply);
            //Assert.AreEqual(0, writeReply.StatusReply.Errorcode); //Bug 15784  We need to separate the errorCode from etblErrorLogRowNo because if ps_etblErrorLogWrite executes successfully, it does not return 0, rather the id of the row created.

            ErrorLogGet(writeReply.EtblErrorLogRowNo, writeRequest);
            CheckEventLogs(expectedMessage);
        }
Пример #2
0
        public void VerifyWriteToEventViewer()
        {
            string expectedMessage = "Specified cast is not valid.";
            startTime = DateTime.Now;

            writeRequest = new ErrorLogWriteRequestDC();
            writeRequest.Timestamp = DateTime.Now;
            // Not filling in the writeRequest will cause the error to be not written to the etblErrorLog table, instead sent to the EventViewer on pqocwfddb01
            writeReply = null;

            try
            {
                writeReply = proxy.ErrorLogWrite(writeRequest);
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to write data to the EventViewer: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to write data to the EventViewer: {0}", ex.Message);
            }

            Assert.IsNotNull(writeReply, "writeReply is null");
            Assert.IsNotNull(writeReply.StatusReply, "writeReply.StatusReply is null");
            Assert.AreEqual(CWF.Constants.SprocValues.GENERIC_CATCH_ID, writeReply.StatusReply.Errorcode, "StatusReply returned the wrong error code. It returned {0} but should have returned -2", writeReply.StatusReply.Errorcode);
            Assert.AreEqual(expectedMessage, writeReply.StatusReply.ErrorMessage, "writeReply.StatusReply.ErrorMessage returned the wrong error message");
            CheckEventLogs(expectedMessage);
        }