Esempio n. 1
0
 static string GetCorrelationId(string taskName)
 {
     try
     {
         var factory  = new TaskServiceConvertorFactory();
         var time     = DateTime.Now;
         var eventLog = factory.CreateTaskEventLog(taskName);
         var events   = (from a in eventLog
                         where a.TaskCategory == "Task Started" && time > StartTime
                         orderby a.TimeCreated
                         select a).LastOrDefault();
         if (null != events)
         {
             return(events.Correlation);
         }
         return("");
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.WriteLine(e.StackTrace);
         Log("Error",
             string.Format(
                 "Error creating task history. Exception: {0}" + Environment.NewLine + "StackTrace: {1}",
                 e.Message, e.StackTrace));
         Environment.Exit(1);
     }
     return("");
 }
        public void CreateTaskEventLog_Givenpath_ShouldReturnDev2TaskEventLog()
        {
            //---------------Set up test pack-------------------
            var factory = new TaskServiceConvertorFactory();

            //---------------Assert Precondition----------------
            Assert.IsNotNull(factory);
            //---------------Execute Test ----------------------
            var taskEventLog = factory.CreateTaskEventLog(It.IsAny <string>());

            //---------------Test Result -----------------------
            Assert.IsNotNull(taskEventLog);
        }