コード例 #1
0
ファイル: Trace.cs プロジェクト: cpatmoore/bio
 /// <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();
     }
 }
コード例 #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();
     }
 }
コード例 #3
0
ファイル: Trace.cs プロジェクト: cpatmoore/bio
 /// <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);
 }
コード例 #4
0
ファイル: TraceBvtTestCases.cs プロジェクト: cpatmoore/bio
        /// <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));
        }
コード例 #5
0
ファイル: TraceBvtTestCases.cs プロジェクト: cpatmoore/bio
        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."));
        }
コード例 #6
0
ファイル: TraceBvtTestCases.cs プロジェクト: cpatmoore/bio
        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."));
        }
コード例 #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();
 }