示例#1
0
 private void ApplyConfigurations(ITestSuiteBase source, ITestSuiteBase target)
 {
     if (source.DefaultConfigurations != null)
     {
         Trace.WriteLine("   CONFIG MNISSMATCH FOUND --- FIX AATTEMPTING", "TestPlansAndSuites");
         target.ClearDefaultConfigurations();
         IList <IdAndName> targetConfigs = new List <IdAndName>();
         foreach (var config in source.DefaultConfigurations)
         {
             var targetFound = (from tc in targetTestConfigs
                                where tc.Name == config.Name
                                select tc).SingleOrDefault();
             if (!(targetFound == null))
             {
                 targetConfigs.Add(new IdAndName(targetFound.Id, targetFound.Name));
             }
         }
         try
         {
             target.SetDefaultConfigurations(targetConfigs);
         }
         catch (Exception)
         {
             // SOmetimes this will error out for no reason.
         }
     }
 }
 /// <summary>
 /// Sets default configurations on migrated test suites.
 /// </summary>
 /// <param name="source">The test suite to take as a source.</param>
 /// <param name="target">The test suite to apply the default configurations to.</param>
 private void ApplyDefaultConfigurations(ITestSuiteBase source, ITestSuiteBase target)
 {
     if (source.DefaultConfigurations != null)
     {
         Trace.WriteLine($"   Setting default configurations for suite {target.Title}", "TestPlansAndSuites");
         IList <IdAndName> targetConfigs = new List <IdAndName>();
         foreach (var config in source.DefaultConfigurations)
         {
             var targetFound = (from tc in targetTestConfigs
                                where tc.Name == config.Name
                                select tc).SingleOrDefault();
             if (targetFound != null)
             {
                 targetConfigs.Add(new IdAndName(targetFound.Id, targetFound.Name));
             }
         }
         try
         {
             target.SetDefaultConfigurations(targetConfigs);
         }
         catch (Exception)
         {
             // SOmetimes this will error out for no reason.
         }
     }
     else
     {
         target.ClearDefaultConfigurations();
     }
 }