예제 #1
0
        public void RunTest()
        {
            ActivityLogger.Log("Starting validation test \"{0}\"", TestName);
            StartTime = DateTime.Now;
            try
            {
                Run();
            }
            catch (Exception e)
            {
                if (AllTestErrorsExcepted())
                {
                    TestOutput.Add(new ValidationTestOutput()
                    {
                        Type = TestOutputType.ErrorMarkedWithException, Output = e.Message + e.StackTrace
                    });
                }
                else
                {
                    throw;
                }
            }

            EndTime = DateTime.Now;
            var elapsedTime = EndTime - StartTime;

            ActivityLogger.Log("Finished validation test \"{0}\" in {1}ms", TestName, elapsedTime.TotalMilliseconds);
        }
예제 #2
0
 public void AddWarning(string message)
 {
     // let's check for Validation Exceptions.
     // #1 - Specific warning exception
     if (Context.ValidationExceptionManager.IsWarningException(TestName, message, Context.PublishPackageInfo.version))
     {
         TestOutput.Add(new ValidationTestOutput()
         {
             Type = TestOutputType.WarningMarkedWithException, Output = message
         });
     }
     // #2 - All test warnings excepted
     else if (AllTestWarningsExcepted())
     {
         TestOutput.Add(new ValidationTestOutput()
         {
             Type = TestOutputType.WarningMarkedWithException, Output = message
         });
     }
     else
     {
         TestOutput.Add(new ValidationTestOutput()
         {
             Type = TestOutputType.Warning, Output = message
         });
     }
 }
예제 #3
0
 protected void AddInformation(string message)
 {
     TestOutput.Add(new ValidationTestOutput()
     {
         Type = TestOutputType.Information, Output = message
     });
 }
예제 #4
0
 public void AddError(string message)
 {
     // let's check for Validation Exceptions.
     // #1 - Specific error exception
     if (CanUseValidationExceptions && Context.ValidationExceptionManager.IsErrorException(TestName, message, Context.PublishPackageInfo.version))
     {
         TestOutput.Add(new ValidationTestOutput()
         {
             Type = TestOutputType.ErrorMarkedWithException, Output = message
         });
     }
     // #2 - All test errors excepted
     else if (AllTestErrorsExcepted())
     {
         TestOutput.Add(new ValidationTestOutput()
         {
             Type = TestOutputType.ErrorMarkedWithException, Output = message
         });
     }
     else
     {
         TestOutput.Add(new ValidationTestOutput()
         {
             Type = TestOutputType.Error, Output = message
         });
         TestState = TestState.Failed;
     }
 }