예제 #1
0
        public void WriteOutExceptions(IAssertionHelper helper)
        {
            if (Setup.Any())
            {
                helper.Log.WriteLine("Set Up Error:");
                foreach (var exception in Setup)
                {
                    helper.Log.Indent();
                    WriteOutFullExceptionHelper(helper, exception);
                    helper.Log.UnIndent();
                }
            }

            if (Test.Any())
            {
                foreach (var exception in Test)
                {
                    WriteOutFullExceptionHelper(helper, exception);
                }
                helper.Log.WriteLine(String.Empty);
            }

            if (Teardown.Any())
            {
                helper.Log.WriteLine("Tear Down Error:");
                foreach (var exception in Teardown)
                {
                    helper.Log.Indent();
                    WriteOutFullExceptionHelper(helper, exception);
                    helper.Log.UnIndent();
                }
            }
        }
예제 #2
0
        public ResultKind GetResult(IAssertionHelper helper)
        {
            if (Test.OfType <IgnoreException>().Any())
            {
                return(ResultKind.Ignore);
            }

            if (Setup.Any() ||
                Teardown.Any() ||
                Test.Any(it => !(it is ResultException)))
            {
                return(ResultKind.Error);
            }

            if (Test.OfType <AssertionException>().Any())
            {
                return(ResultKind.Fail);
            }

            if (!Assert._globalStyleUsed && helper.Assert.AssertCount == 0)
            {
                return(ResultKind.NoError);
            }

            return(ResultKind.Success);
        }
예제 #3
0
파일: Result.cs 프로젝트: jbtule/PclUnit
 public Result(string platform, ResultKind kind, DateTime startTime, DateTime endTime, IAssertionHelper helper)
 {
     Platform = platform;
     Kind = kind;
     StartTime = startTime;
     EndTime = endTime;
     Output = helper.Log.ToString();
     if (Assert._globalStyleUsed && helper.Assert.AssertCount == 0)
         AssertCount = -1;
     else
         AssertCount = helper.Assert.AssertCount;
 }
예제 #4
0
 private void WriteOutFullExceptionHelper(IAssertionHelper helper, Exception ex)
 {
     if (ex is AssertionException)
     {
         helper.Log.WriteLine(ex.Message);
         helper.Log.WriteLine(ex.StackTrace);
     }
     else if (ex is IgnoreException)
     {
         helper.Log.Write(ex.Message);
     }
     else
     {
         helper.Log.Write("{0}: ", ex.GetType().Name);
         helper.Log.WriteLine(ex.Message);
         helper.Log.WriteLine(ex.StackTrace);
         if (ex.InnerException != null)
         {
             WriteOutFullExceptionHelper(helper, ex);
         }
     }
 }
예제 #5
0
 private void WriteOutFullExceptionHelper(IAssertionHelper helper, Exception ex)
 {
     if (ex is AssertionException)
     {
         helper.Log.WriteLine(ex.Message);
         helper.Log.WriteLine(ex.StackTrace);
     }
     else if (ex is IgnoreException)
     {
         helper.Log.Write(ex.Message);
     }
     else
     {
         helper.Log.Write("{0}: ", ex.GetType().Name);
         helper.Log.WriteLine(ex.Message);
         helper.Log.WriteLine(ex.StackTrace);
         if (ex.InnerException != null)
             WriteOutFullExceptionHelper(helper, ex);
     }
 }
예제 #6
0
        public void WriteOutExceptions(IAssertionHelper helper)
        {
            if (Setup.Any())
            {
                helper.Log.WriteLine("Set Up Error:");
                foreach (var exception in Setup)
                {
                    helper.Log.Indent();
                    WriteOutFullExceptionHelper(helper, exception);
                    helper.Log.UnIndent();
                }
            }

            if (Test.Any())
            {
                foreach (var exception in Test)
                {
                    WriteOutFullExceptionHelper(helper, exception);
                }
                helper.Log.WriteLine(String.Empty);
            }

            if (Teardown.Any())
            {
                helper.Log.WriteLine("Tear Down Error:");
                foreach (var exception in Teardown)
                {
                    helper.Log.Indent();
                    WriteOutFullExceptionHelper(helper, exception);
                    helper.Log.UnIndent();
                }
            }
        }
예제 #7
0
        public ResultKind GetResult(IAssertionHelper helper)
        {
            if (Test.OfType<IgnoreException>().Any())
                return ResultKind.Ignore;

            if(Setup.Any()
               || Teardown.Any()
               || Test.Any(it => !(it is ResultException)))
                return ResultKind.Error;

            if(Test.OfType<AssertionException>().Any())
                return ResultKind.Fail;

            if (!Assert._globalStyleUsed && helper.Assert.AssertCount == 0)
            {
                return ResultKind.NoError;
            }

            return ResultKind.Success;
        }
예제 #8
0
 public Result(string platform, ResultKind kind, DateTime startTime, DateTime endTime, IAssertionHelper helper)
 {
     Platform  = platform;
     Kind      = kind;
     StartTime = startTime;
     EndTime   = endTime;
     Output    = helper.Log.ToString();
     if (Assert._globalStyleUsed && helper.Assert.AssertCount == 0)
     {
         AssertCount = -1;
     }
     else
     {
         AssertCount = helper.Assert.AssertCount;
     }
 }