コード例 #1
0
            private void VerifyException(Exception ex)
            {
                if (String.IsNullOrEmpty(this.Attribute.MessagePattern))
                {
                    return;
                }

                INameMatcher matcher = NameMatcherFactory.CreateMatcher(
                    this.Attribute.MessageMatchType,
                    this.Attribute.MessagePattern);

                if (!matcher.IsMatch(ex.Message))
                {
                    throw new ExceptionMessageDoesNotMatchException(matcher, ex);
                }
            }
コード例 #2
0
 public override void Run(object fixture)
 {
     System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         this.TestCase.Run(fixture);
     }
     finally
     {
         // looking for processes to kill
         INameMatcher matcher = NameMatcherFactory.CreateMatcher(this.Attribute.MatchType, this.Attribute.Name);
         foreach (Process p in Process.GetProcesses())
         {
             if (matcher.IsMatch(p.ProcessName))
             {
                 Console.WriteLine("Killing {0} {1}", p.Id, p.ProcessName);
                 p.Kill();
             }
         }
     }
 }