/// <summary>
        /// Parses the configuration file and creates an instance of <see cref="LogProfile"/> .
        /// </summary>
        /// <returns>An instance of LogProfile.</returns>
        public static LogProfile CreateLogProfileFromConfig(IConfigurationData config, string testAssemblyName)
        {
            if (config == null)
            {
                return null;
            }

            // Create a temp instance of parser.
            LogProfileParser parser = new LogProfileParser();

            // Gets the active log profile name.
            if ((activeProfileName = config.DefaultProfile) == null)
            {
                throw new InvalidOperationException("The active profile name is not present.");
            }

            // Create LogProfile instance.
            parser.logProfile = new LogProfile();

            parser.ParseSinks(config.LogSinks, testAssemblyName);

            parser.ParseProfiles(config.Profiles);

            return parser.logProfile;
        }
        private string GetValue(IConfigurationData config, object value)
        {
            if (!string.IsNullOrEmpty(config.AvailableValues))
            {
                ComboBox cmb = value as ComboBox;

                if (cmb != null && cmb.SelectedItem != null)
                {
                    Tuple <string, string> item = cmb.SelectedItem as Tuple <string, string>;

                    if (item != null)
                    {
                        return(item.Item2);
                    }
                }
            }
            else
            {
                TextBox txt = value as TextBox;

                if (txt != null)
                {
                    return(txt.Text);
                }
            }

            return(string.Empty);
        }
        /// <summary>
        /// Parses the configuration file and creates an instance of <see cref="LogProfile"/> .
        /// </summary>
        /// <returns>An instance of LogProfile.</returns>
        public static LogProfile CreateLogProfileFromConfig(IConfigurationData config, string testAssemblyName)
        {
            if (config == null)
            {
                return(null);
            }

            // Create a temp instance of parser.
            LogProfileParser parser = new LogProfileParser();

            // Gets the active log profile name.
            if ((activeProfileName = config.DefaultProfile) == null)
            {
                throw new InvalidOperationException("The active profile name is not present.");
            }

            // Create LogProfile instance.
            parser.logProfile = new LogProfile();

            parser.ParseSinks(config.LogSinks, testAssemblyName);

            parser.ParseProfiles(config.Profiles);

            return(parser.logProfile);
        }
 public ACustomerBase(int id, ASubscription subscription, IManager manager)
 {
     this.id                = id;
     this.subscription      = subscription;
     this.log               = manager.Log;
     this.configurationData = manager.ConfigurationData;
 }
Beispiel #5
0
        protected BaseAuthenticator(IConfigurationData configurationData)
        {
            Ensure.ArgumentNotNull(nameof(configurationData), configurationData);

            SiteInfo    = configurationData.SiteInfo;
            Credentials = configurationData.Credentials;
        }
Beispiel #6
0
        private void HandleScreenshotPreviewSize(TableLayoutPanel tblMain, IConfigurationData config, DpiScale dpiScale)
        {
            m_lblScreenshotWidth = new Label
            {
                Width  = dpiScale.ScaleIntX(68),
                Height = dpiScale.ScaleIntY(16),
                Margin = new Padding(0, dpiScale.ScaleIntX(8), 0, 0)
            };

            m_screenshotTrackBar = new TrackBar
            {
                Minimum = -8,
                Maximum = 8,
                Value   = Convert.ToInt32(config.Value),
                Width   = dpiScale.ScaleIntX(200)
            };
            m_screenshotTrackBar.ValueChanged += Trk_ValueChanged;

            FlowLayoutPanel flp = new FlowLayoutPanel
            {
                Dock = DockStyle.Fill
            };

            flp.Controls.Add(m_screenshotTrackBar);
            flp.Controls.Add(m_lblScreenshotWidth);

            tblMain.Controls.Add(flp, 1, tblMain.RowStyles.Count - 1);
            m_configValues.Add(new Tuple <IConfigurationData, object>(config, m_screenshotTrackBar));
        }
        private string GetValue(IConfigurationData config, object value)
        {
            if (value is ComboBox && !string.IsNullOrEmpty(config.AvailableValues))
            {
                ComboBox cmb = value as ComboBox;

                if (cmb != null && cmb.SelectedItem != null)
                {
                    Tuple <string, string> item = cmb.SelectedItem as Tuple <string, string>;
                    return(item.Item2);
                }
            }
            else if (value is TrackBar)
            {
                TrackBar trk = value as TrackBar;
                return(trk.Value.ToString());
            }
            else if (value is TextBox)
            {
                TextBox txt = value as TextBox;
                return(txt.Text);
            }

            return(string.Empty);
        }
Beispiel #8
0
 private string GetValue(IConfigurationData config, object value)
 {
     if (!string.IsNullOrEmpty(config.AvailableValues) && value is ComboBox cmb && cmb.SelectedItem != null)
     {
         Tuple <string, string> item = cmb.SelectedItem as Tuple <string, string>;
         return(item.Item2);
     }
        private static void InitializeTestSite(
            IConfigurationData config,
            string configPath,
            string testSuiteName,
            PtfTestOutcome currentTestOutCome,
            string testAssemblyName)
        {
            if (null == config)
            {
                throw new ArgumentException("config cannot be null.");
            }

            if (testSites == null)
            {
                testSites = new Dictionary <string, DefaultTestSite>();
            }

            if (!testSites.ContainsKey(testSuiteName))
            {
                DefaultTestSite testSite = new DefaultTestSite(config, configPath, testSuiteName, testAssemblyName);

                testSites.Add(testSuiteName, testSite);
            }
            else
            {
                testSites[testSuiteName].DisposeAdapters();
            }

            testSites[testSuiteName].TestProperties[TestPropertyNames.CurrentTestCaseName] = null;
            testSites[testSuiteName].TestProperties[TestPropertyNames.CurrentTestOutcome]  = currentTestOutCome;
        }
        public void InsertConfiguration(IConfigurationData config)
        {
            List <DbParameter> parameters;
            string             insert = InsertStatement("Configuration", config, new string[] { "ConfigID" }, out parameters);

            DataAccess.ExecuteNonQuery(insert, parameters);
        }
 public void Initialize(
     IConfigurationData config,
     string configPath,
     string testSuiteName,
     string testAssemblyName)
 {
     TestSiteProvider.Initialize(config, configPath, testSuiteName, testAssemblyName);
 }
 public void Initialize(
     IConfigurationData config,
     string configPath,
     string testSuiteName,
     string testAssemblyName)
 {
     TestSiteProvider.Initialize(config, configPath, testSuiteName, testAssemblyName);
 }
 /// <summary>
 /// Initializes the test suite
 /// </summary>
 /// <param name="config">Configure data</param>
 /// <param name="context">Context</param>
 /// <param name="testSuiteName">TestSuite name</param>
 /// <param name="testAssemblyName">Assembley name</param>
 public static void Initialize(
     IConfigurationData config,
     IProtocolTestContext context,
     string testSuiteName,
     string testAssemblyName)
 {
     TestSiteProvider.Initialize(config, context, testSuiteName, testAssemblyName);
 }
 public void Initialize(
     IConfigurationData config,
     IProtocolTestContext context,
     string testSuiteName,
     string testAssemblyName)
 {
     TestSiteProvider.Initialize(config, context, testSuiteName, testAssemblyName);
 }
        /// <summary>
        /// Initializes the current test site, based on test test context and test suite name.
        /// If a current test site exists which does have same test suite name,
        /// it will be reused, otherwise a new one will be created, otherwise the current one
        /// will be reused.
        /// </summary>
        /// <param name="config">Configuration data from ptfconfig</param>
        /// <param name="context"></param>
        /// <param name="testSuiteName"></param>
        /// <param name="testAssemblyName">Test assembly name</param>
        public static void Initialize(
            IConfigurationData config, IProtocolTestContext context, string testSuiteName, string testAssemblyName)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context", "Test context cannot be null.");
            }

            Initialize(config, context.TestDeploymentDir, testSuiteName, testAssemblyName);
        }
        private AppVersion GetVersion()
        {
            IConfigurationData config = m_adapter.GetConfiguration().FirstOrDefault(x => x.Name == "Version");

            if (config != null)
            {
                return((AppVersion)Convert.ToInt32(config.Value));
            }

            return(AppVersion.Unknown);
        }
        public void EnableCopySaveFiles()
        {
            CopySaveFiles = true;
            IConfigurationData config = DataSourceAdapter.GetConfiguration().FirstOrDefault(x => x.Name == CopySaveFilesName);

            if (config != null)
            {
                config.Value = "true";
                DataSourceAdapter.UpdateConfiguration(config);
            }
        }
        /// <summary>
        /// Initializes the current test site, using the given config search path and test suite name.
        /// If a current test site exists which does have same test suite name,
        /// it will be reused, otherwise a new one will be created, otherwise the current one
        /// will be reused.
        /// </summary>
        /// <param name="config">Configuration data from ptfconfig</param>
        /// <param name="configPath"></param>
        /// <param name="testSuiteName"></param>
        /// <param name="testAssemblyName">Test assembly name</param>
        public static void Initialize(
            IConfigurationData config, string configPath, string testSuiteName, string testAssemblyName)
        {
            if (string.IsNullOrEmpty(configPath))
            {
                throw new ArgumentException("configPath cannot be null or empty.", "configPath");
            }


            InitializeTestSite(config, configPath, testSuiteName, PtfTestOutcome.Unknown, testAssemblyName);
        }
Beispiel #19
0
        public string GetConfigValue(ConfigType ct)
        {
            IConfigurationData config = DataSourceAdapter.GetConfiguration().FirstOrDefault(x => x.Name == ct.ToString("g"));

            if (config != null)
            {
                return(config.Value);
            }

            return(null);
        }
Beispiel #20
0
        public ReprintSingleViewModel(IRegionManager regionManager, IDialogCoordinator dialogCoordinator,
                                      ISubmitDocumentList submitDocumentList, IConfigurationData configurationData, SessionData sessionData)
        {
            this.dialogCoordinator  = dialogCoordinator;
            this.regionManager      = regionManager;
            LogoutCommand           = new DelegateCommand(ReturnToLogin);
            this.submitDocumentList = submitDocumentList;
            this.sessionData        = sessionData;
            this.workflowIdLength   = configurationData.WorkflowIdLength;
            DocumentIdLength        = configurationData.WorkflowIdLength + configurationData.DocumentNumberLength;

            AddToListCommand      = new DelegateCommand(AddToList, IsIdValid);
            RemoveFromListCommand = new DelegateCommand(RemoveFromList, IsIdSelected);
            SaveCommand           = new DelegateCommand(SaveDataAsync, ListHasData).ObservesProperty(() => DocumentIDs.Count);
        }
        public void UpdateConfiguration(IConfigurationData config)
        {
            string query = @"update Configuration set 
            Name = @Name, Value = @Value, AvailableValues = @AvailableValues
            where ConfigID = @ConfigID";

            List <DbParameter> parameters = new List <DbParameter>();

            parameters.Add(DataAccess.DbAdapter.CreateParameter("Name", config.Name == null ? string.Empty : config.Name));
            parameters.Add(DataAccess.DbAdapter.CreateParameter("Value", config.Value == null ? string.Empty : config.Value));
            parameters.Add(DataAccess.DbAdapter.CreateParameter("AvailableValues", config.AvailableValues == null ? string.Empty : config.AvailableValues));
            parameters.Add(DataAccess.DbAdapter.CreateParameter("ConfigID", config.ConfigID));

            DataAccess.ExecuteNonQuery(query, parameters);
        }
        /// <summary>
        /// Initializes the test suite base class with explicitly given test suite name.
        /// This method must be called by class initialize method in your test class.
        /// </summary>
        /// <param name="testContext">VSTS test context.</param>
        /// <param name="testSuiteName">The name of the test suite. The test site uses this name to find configuration files.</param>
        public static void Initialize(TestContext testContext, string testSuiteName)
        {
            executionStartTime = DateTime.Now;
            if (testContext == null)
            {
                throw new InvalidOperationException("TestContext should not be null in UnitTestClassBase.");
            }
            classCount++;
            staticTestSuiteName = testSuiteName;

            if (null == ProtocolTestsManager.GetTestSite(staticTestSuiteName))
            {
                VstsTestContext    vstsTestContext = new VstsTestContext(testContext);
                IConfigurationData config          = ConfigurationDataProvider.GetConfigurationData(
                    vstsTestContext.PtfconfigDir, testSuiteName);

                string testAssemblyName;

                if (isUseDefaultSuiteName)
                {
                    testAssemblyName      = testSuiteName;
                    isUseDefaultSuiteName = false;
                }
                else
                {
                    testAssemblyName = Assembly.GetCallingAssembly().GetName().Name;
                }

                ProtocolTestsManager.Initialize(config, vstsTestContext, testSuiteName, testAssemblyName);

                baseTestSite = ProtocolTestsManager.GetTestSite(testSuiteName);

                ITestSite site = ProtocolTestsManager.GetTestSite(testSuiteName);

                //registry all checkers
                RegisterChecker(site);
            }
            else
            {
                baseTestSite = ProtocolTestsManager.GetTestSite(testSuiteName);
            }


            /********************* Display expected runtime of the testsuite **********************
            * Log expected execution time of the test suite in the log file                      *
            **************************************************************************************/
            baseTestSite.Log.Add(LogEntryKind.Comment, "Expected execution time of the test suite (in seconds) is: " + baseTestSite.Properties.Get("ExpectedExecutionTime"));
        }
        public HalFileViewModel(IRegionManager regionManager, IDialogCoordinator dialogCoordinator, ISubmitHalFile submitHalFile,
                                IConfigurationData configurationData, SessionData sessionData)
        {
            this.dialogCoordinator = dialogCoordinator;
            this.regionManager     = regionManager;
            LogoutCommand          = new DelegateCommand(ReturnToLogin);
            this.submitHalFile     = submitHalFile;
            this.sessionData       = sessionData;

            SaveCommand = new DelegateCommand(SaveDataAsync, AllDataInput)
                          .ObservesProperty(() => SelectedSite)
                          .ObservesProperty(() => WorkflowID);

            Sites            = new ObservableCollection <Site>(configurationData.Sites);
            WorkflowIdLength = configurationData.WorkflowIdLength;
        }
        private void WriteVersion(AppVersion version)
        {
            IConfigurationData config = m_adapter.GetConfiguration().FirstOrDefault(x => x.Name == "Version");

            if (config != null)
            {
                config.Value = Convert.ToInt32(version).ToString();
                m_adapter.UpdateConfiguration(config);
            }
            else
            {
                ConfigurationData newConfig = new ConfigurationData();
                newConfig.Name          = "Version";
                newConfig.UserCanModify = false;
                newConfig.Value         = Convert.ToInt32(version).ToString();
                m_adapter.InsertConfiguration(newConfig);
            }
        }
Beispiel #25
0
        /// <summary>
        /// 打开自定义配置文件
        /// </summary>
        /// <param name="fileName">配置文件名</param>
        /// <param name="rootKey">根节点名称</param>
        /// <param name="defaultConfigurationData">默认配置文件实体数据</param>
        public AssemblyConfiguration(string fileName, string rootKey, IConfigurationData defaultConfigurationData)
        {
            FileName        = fileName;
            BaseDir         = Path.Combine(AppContext.BaseDirectory, "Config");
            PathAndFileName = Path.Combine(BaseDir, fileName);
            RootKey         = rootKey;

            if (defaultConfigurationData != null)
            {
                if (!File.Exists(PathAndFileName))
                {
                    DefaultConfigurationJson = defaultConfigurationData.ToJson(Formatting.Indented);
                    NeedCreateFile           = true;
                }
            }

            Init();
        }
Beispiel #26
0
        private void UpdateConfig(IEnumerable <IConfigurationData> config, string name, string value)
        {
            IConfigurationData configFind = config.Where(x => x.Name == name).FirstOrDefault();

            if (configFind == null)
            {
                configFind               = new ConfigurationData();
                configFind.Name          = name;
                configFind.Value         = value;
                configFind.UserCanModify = false;
                DataSourceAdapter.InsertConfiguration(configFind);
            }
            else
            {
                configFind.Value = value;
                DataSourceAdapter.UpdateConfiguration(configFind);
            }
        }
Beispiel #27
0
        public CardsViewModel(IRegionManager regionManager, IDialogCoordinator dialogCoordinator, ISubmitCardInfo submitCardInfo,
                              IConfigurationData configurationData, SessionData sessionData)
        {
            this.dialogCoordinator = dialogCoordinator;
            this.regionManager     = regionManager;
            LogoutCommand          = new DelegateCommand(ReturnToLogin);

            this.submitCardInfo = submitCardInfo;
            this.sessionData    = sessionData;
            SaveCommand         = new DelegateCommand(SaveDataAsync, AllDataInput)
                                  .ObservesProperty(() => SelectedCardType)
                                  .ObservesProperty(() => SelectedCardSubType)
                                  .ObservesProperty(() => SelectedSite)
                                  .ObservesProperty(() => RunNumber);

            CardTypes          = new ObservableCollection <CardType>(configurationData.CardTypes);
            Sites              = new ObservableCollection <Site>(configurationData.Sites);
            MaxRunNumberLength = configurationData.MaxRunNumberLength;
        }
Beispiel #28
0
        private void HandleLaunchSettings()
        {
            string[] configNames = new string[]
            {
                ConfigType.DefaultSourcePort.ToString("g"),
                ConfigType.DefaultIWad.ToString("g"),
                ConfigType.DefaultSkill.ToString("g"),
                ConfigType.FileManagement.ToString("g"),
                ConfigType.GameFileViewType.ToString("g"),
            };
            string[] configValues = new string[]
            {
                cmbSourcePorts.SelectedItem == null ? null : ((ISourcePortData)cmbSourcePorts.SelectedItem).SourcePortID.ToString(),
                cmbIwad.SelectedItem == null ? null : ((IIWadData)cmbIwad.SelectedItem).IWadID.ToString(),
                cmbSkill.SelectedItem?.ToString(),
                cmbFileManagement.SelectedValue.ToString(),
                ((GameFileViewType)cmbViewType.SelectedIndex).ToString(),
            };

            IEnumerable <IConfigurationData> configuration = m_adapter.GetConfiguration().Where(x => configNames.Contains(x.Name));

            for (int i = 0; i < configNames.Length; i++)
            {
                string             configName  = configNames[i];
                string             configValue = configValues[i];
                IConfigurationData config      = configuration.FirstOrDefault(x => x.Name == configName);

                if (configValue != null)
                {
                    if (config == null)
                    {
                        config = CreateConfig(configName, configValue);
                        m_adapter.InsertConfiguration(config);
                    }
                    else
                    {
                        config.Value = configValue;
                        m_adapter.UpdateConfiguration(config);
                    }
                }
            }
        }
Beispiel #29
0
        /// <summary>
        /// Constructs a new instance of DefaultTestSite.
        /// All checkers, loggers and adapter types are initialized in this constructor.
        /// </summary>
        /// <param name="config">Configuration data from ptfconfig</param>
        /// <param name="testAssemblyDirectory">The path of test assembly directory.</param>
        /// <param name="ptfconfigDirectory">The path of ptfconfig directory.</param>
        /// <param name="testSuiteName">The name of the test suite. The test site uses this name to find configuration files.</param>
        /// <param name="testAssemblyName">The test assembly name</param>
        public DefaultTestSite(IConfigurationData config, string testAssemblyDirectory, string ptfconfigDirectory, string testSuiteName, string testAssemblyName)
        {
            this.testSuiteName    = testSuiteName;
            this.testAssemblyName = testAssemblyName;

            this.testAssemblyDirectory = testAssemblyDirectory;
            this.ptfconfigDirectory    = ptfconfigDirectory;

            // initialize event table
            eventTable = new Dictionary <string, EventHandler <TestStartFinishEventArgs> >();
            eventTable.Add("TestStarted", null);
            eventTable.Add("TestFinished", null);

            // clear default protocol short name
            defaultProtocolDocShortName = string.Empty;

            this.properties = config.Properties;
            this.configData = config;
            logger          = new Logger(this);

            skipRequirement = new List <RequirementType>();
            if (Convert.ToBoolean(properties.Get("SkipMUSTRequirements")))
            {
                skipRequirement.Add(RequirementType.Must);
            }
            if (Convert.ToBoolean(properties.Get("SkipSHOULDRequirements")))
            {
                skipRequirement.Add(RequirementType.Should);
            }
            if (Convert.ToBoolean(properties.Get("SkipMAYRequirements")))
            {
                skipRequirement.Add(RequirementType.May);
            }
            if (Convert.ToBoolean(properties.Get("SkipPRODUCTRequirements")))
            {
                skipRequirement.Add(RequirementType.Product);
            }
            if (Convert.ToBoolean(properties.Get("SkipUNDEFINEDRequirements")))
            {
                skipRequirement.Add(RequirementType.Undefined);
            }
        }
        public void HandleElement(XElement ancestor)
        {
            if (ancestor == null)
            {
                throw new ArgumentNullException("ancestor");
            }
            if (!ElementName.Equals(ancestor.Name.LocalName, StringComparison.OrdinalIgnoreCase))
            {
                throw new XmlConfigurationException(ancestor, "Unexpected element '{0}' (expecting '{1}').",
                                                    ancestor.Name.LocalName, ElementName);
            }

            IList <T> result = new List <T>();

            foreach (XElement element in ancestor.Elements())
            {
                string typeName = element.Name.LocalName;
                if (!_collector.Value.Contains(typeName))
                {
                    throw new XmlConfigurationException(element, "Unknown element");
                }

                ConfigurationTypeInfo  typeInfo = _collector.Value.GetTypeInfo(typeName);
                IConfigurationData <T> data     = typeInfo.CreateInstance <IConfigurationData <T> >();

                var attributes  = element.Attributes().Select(x => new KeyValuePair <string, string>(x.Name.LocalName, x.Value));
                var subelements = element.Elements().Select(x => new KeyValuePair <string, string>(x.Name.LocalName, x.Value));

                foreach (var kv in attributes.Concat(subelements))
                {
                    SetPropertyValue(element, typeInfo, data, kv.Key, kv.Value);
                }

                T      item = data.CreateObject();
                string id   = GetItemId(item);
                if (_items.ContainsKey(id))
                {
                    throw new XmlConfigurationException(element, "Duplicate item (id '{0}') found.", id);
                }
                _items.Add(id, item);
            }
        }
        private void HandleTextBox(TableLayoutPanel tblMain, IConfigurationData config)
        {
            TextBox txt = new TextBox();

            txt.Dock = DockStyle.Fill;
            txt.Text = config.Value;
            m_configValues.Add(new Tuple <IConfigurationData, object>(config, txt));

            if (config.Name == "GameFileDirectory")
            {
                HandleGameFileDirectory(tblMain, txt);
            }
            else if (config.Name == "ScreenshotCaptureDirectories")
            {
                HandleScreenshotCaptureDirectories(tblMain, txt);
            }
            else
            {
                tblMain.Controls.Add(txt, 1, tblMain.RowStyles.Count - 1);
            }
        }
        private void HandleComboBox(TableLayoutPanel tblMain, IConfigurationData config)
        {
            ComboBox cmb = new ComboBox();

            cmb.Dock = DockStyle.Fill;

            string[] items = config.AvailableValues.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            List <Tuple <string, string> > cmbDataSource = new List <Tuple <string, string> >();

            for (int i = 0; i < items.Length - 1; i += 2)
            {
                cmbDataSource.Add(new Tuple <string, string>(items[i], items[i + 1]));
            }

            cmb.ValueMember    = "Item1";
            cmb.DataSource     = cmbDataSource;
            cmb.BindingContext = new BindingContext();
            cmb.SelectedItem   = cmbDataSource.FirstOrDefault(x => x.Item2 == config.Value);

            tblMain.Controls.Add(cmb, 1, tblMain.RowStyles.Count - 1);
            m_configValues.Add(new Tuple <IConfigurationData, object>(config, cmb));
        }
Beispiel #33
0
        private void HandleComboBox(TableLayoutPanel tblMain, IConfigurationData config)
        {
            ComboBox cmb = new ComboBox
            {
                Anchor = AnchorStyles.Left,
                Width  = GetDefaultControlWidth()
            };

            string[] items = Util.SplitString(config.AvailableValues);
            List <Tuple <string, string> > cmbDataSource = new List <Tuple <string, string> >();

            for (int i = 0; i < items.Length - 1; i += 2)
            {
                cmbDataSource.Add(new Tuple <string, string>(items[i], items[i + 1]));
            }

            cmb.ValueMember    = "Item1";
            cmb.DataSource     = cmbDataSource;
            cmb.BindingContext = new BindingContext();
            cmb.SelectedItem   = cmbDataSource.FirstOrDefault(x => x.Item2 == config.Value);

            tblMain.Controls.Add(cmb, 1, tblMain.RowStyles.Count - 1);
            m_configValues.Add(new Tuple <IConfigurationData, object>(config, cmb));
        }
        /// <summary>
        /// Initializes the current test site, using the given config search path and test suite name.
        /// If a current test site exists which does have same test suite name,
        /// it will be reused, otherwise a new one will be created, otherwise the current one
        /// will be reused.
        /// </summary>
        /// <param name="config">Configuration data from ptfconfig</param>
        /// <param name="configPath"></param>
        /// <param name="testSuiteName"></param>
        /// <param name="testAssemblyName">Test assembly name</param>
        public static void Initialize(
            IConfigurationData config, string configPath, string testSuiteName, string testAssemblyName)
        {
            if (string.IsNullOrEmpty(configPath))
            {
                throw new ArgumentException("configPath cannot be null or empty.", "configPath");
            }

            InitializeTestSite(config, configPath, testSuiteName, PtfTestOutcome.Unknown, testAssemblyName);
        }
        private static void InitializeTestSite(
            IConfigurationData config,
            string configPath, 
            string testSuiteName,
            PtfTestOutcome currentTestOutCome,
            string testAssemblyName)
        {
            if (null == config)
            {
                throw new ArgumentException("config cannot be null.");
            }

            if (testSites == null)
            {
                testSites = new Dictionary<string, DefaultTestSite>();
            }

            if (!testSites.ContainsKey(testSuiteName))
            {
                DefaultTestSite testSite = new DefaultTestSite(config, configPath, testSuiteName, testAssemblyName);

                testSites.Add(testSuiteName, testSite);
            }
            else
            {
                testSites[testSuiteName].DisposeAdapters();
            }

            testSites[testSuiteName].TestProperties[TestPropertyNames.CurrentTestCaseName] = null;
            testSites[testSuiteName].TestProperties[TestPropertyNames.CurrentTestOutcome] = currentTestOutCome;
        }
        /// <summary>
        /// Initializes the current test site, based on test test context and test suite name.
        /// If a current test site exists which does have same test suite name,
        /// it will be reused, otherwise a new one will be created, otherwise the current one
        /// will be reused.
        /// </summary>
        /// <param name="config">Configuration data from ptfconfig</param>
        /// <param name="context"></param>
        /// <param name="testSuiteName"></param>
        /// <param name="testAssemblyName">Test assembly name</param>
        public static void Initialize(
            IConfigurationData config, IProtocolTestContext context, string testSuiteName, string testAssemblyName)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context", "Test context cannot be null.");
            }

            Initialize(config, context.TestDeploymentDir, testSuiteName, testAssemblyName);
        }