Exemple #1
0
 /// <summary>
 /// Report a TraceMessage, by adding it to the front of the message
 /// queue, as well as logging it.
 /// </summary>
 /// <param name="m">the Trace message</param>
 public static void Report(TraceMessage m)
 {
     if (m != null)
     {
         Messages.Insert(0, m);
         ApplicationLog.WriteLine(m.Format());
         TrimToSize();
     }
 }
Exemple #2
0
 /// <summary>
 /// Report a TraceMessage, by adding it to the front of the message
 /// queue, as well as logging it.
 /// </summary>
 /// <param name="m">the Trace message</param>
 public static void Report(TraceMessage m)
 {
     if (m != null)
     {
         messages.Insert(0, m);
         ApplicationLog.WriteLine(m.Format());
         TrimToSize();
     }
 }
Exemple #3
0
 /// <summary>
 /// Overload that constructs the TraceMessage from its parts.
 /// </summary>
 /// <param name="context">Where the incident occurred.</param>
 /// <param name="message">The details of what happened.</param>
 /// <param name="data">Pertinent data such as argument values.</param>
 public static void Report(string context, string message, string data)
 {
     DateTime when = DateTime.Now;
     TraceMessage m = new TraceMessage(context, message, data, when);
     Report(m);
 }
Exemple #4
0
        /// <summary>
        /// General Method to validate Data.
        /// </summary>
        /// <param name="traceData">Data created using trace class.</param>
        /// <param name="traceMessageData">Data created using trace message class.</param>
        private static void ValidateTraceMessages(TraceMessage traceMessageData, TraceMessage traceData)
        {
            PrivateObject readTrace = new PrivateObject(traceData);
            PrivateObject readTraceMessage = new PrivateObject(traceMessageData);

            Assert.AreEqual(readTrace.GetField(Constants.MessageNode), readTraceMessage.GetField(Constants.MessageNode));
            Assert.AreEqual(readTrace.GetField(Constants.ContextParameterNode), readTraceMessage.GetField(Constants.ContextParameterNode));
            Assert.AreEqual(readTrace.GetField(Constants.DataParameterNode), readTraceMessage.GetField(Constants.DataParameterNode));
        }
Exemple #5
0
        public void ValidateTraceReportForParams()
        {
            message = utilityObj.xmlUtil.GetTextValue(
                Constants.UtilTraceNode,
                Constants.MessageNode);
            data = utilityObj.xmlUtil.GetTextValue(
                Constants.UtilTraceNode,
                Constants.DataParameterNode);
            context = utilityObj.xmlUtil.GetTextValue(
                Constants.UtilTraceNode,
                Constants.ContextParameterNode);
            TraceMessage traceMessage = new TraceMessage(context, message, data);
            Trace.Report(context, message, data);

            ////Validate Trace Message.
            TraceMessage queueMsg = Trace.GetMessage(0);
            Assert.IsNotNull(queueMsg);
            ValidateTraceMessages(traceMessage, queueMsg);

            ApplicationLog.WriteLine(string.Concat(
                  "Trace BVT: Validation of Report method for context, message and data completed successfully."));
        }
Exemple #6
0
        public void ValidateTraceLatestMessageForMessage()
        {
            message = utilityObj.xmlUtil.GetTextValue(
                Constants.UtilTraceNode,
                Constants.MessageNode);

            TraceMessage traceMessage = new TraceMessage(String.Empty, message, String.Empty);
            Trace.Report(message);

            ////Validate Trace Message.
            TraceMessage queueMsg = Trace.GetMessage(0);
            Assert.IsNotNull(queueMsg);
            ValidateTraceMessages(traceMessage, queueMsg);

            ApplicationLog.WriteLine(string.Concat(
                  "Trace BVT: Validation of Report method for message completed successfully."));
        }
Exemple #7
0
 /// <summary>
 /// Report a TraceMessage, by adding it to the front of the message
 /// queue, as well as logging it.
 /// </summary>
 /// <param name="m"></param>
 public static void Report(TraceMessage m)
 {
     s_messages.Insert(0, m);
     ApplicationLog.WriteLine(m.Format());
     trimToSize();
 }