static TestBase() { XElement element = XElement.Load(TestConfigurations.DefaultTestConfigFilePath); TestConfigurations configurations = TestConfigurations.ReadFromXml(element); TestBase.Initialize(configurations); }
public static TestConfigurations ReadFromXml(XElement testConfigurationsElement) { TestConfigurations result = new TestConfigurations(); result.TargetTenantName = (string)testConfigurationsElement.Element("TargetTestTenant"); List<TenantConfiguration> tenantConfigurationList = new List<TenantConfiguration>(); foreach (XElement tenantConfigurationElement in testConfigurationsElement.Element("TenantConfigurations").Elements("TenantConfiguration")) { TenantConfiguration config = new TenantConfiguration(); config.TenantName = (string)tenantConfigurationElement.Element("TenantName"); config.AccountName = (string)tenantConfigurationElement.Element("AccountName"); config.AccountKey = (string)tenantConfigurationElement.Element("AccountKey"); config.BlobServiceEndpoint = (string)tenantConfigurationElement.Element("BlobServiceEndpoint"); config.QueueServiceEndpoint = (string)tenantConfigurationElement.Element("QueueServiceEndpoint"); config.TableServiceEndpoint = (string)tenantConfigurationElement.Element("TableServiceEndpoint"); config.BlobServiceSecondaryEndpoint = (string)tenantConfigurationElement.Element("BlobServiceSecondaryEndpoint"); config.QueueServiceSecondaryEndpoint = (string)tenantConfigurationElement.Element("QueueServiceSecondaryEndpoint"); config.TableServiceSecondaryEndpoint = (string)tenantConfigurationElement.Element("TableServiceSecondaryEndpoint"); config.TenantType = (TenantType)Enum.Parse(typeof(TenantType), (string)tenantConfigurationElement.Element("TenantType"), true); tenantConfigurationList.Add(config); } result.TenantConfigurations = tenantConfigurationList; return result; }
public static TestConfigurations ReadFromXml(XElement testConfigurationsElement) { TestConfigurations result = new TestConfigurations(); result.TargetTenantName = (string)testConfigurationsElement.Element("TargetTestTenant"); List <TenantConfiguration> tenantConfigurationList = new List <TenantConfiguration>(); foreach (XElement tenantConfigurationElement in testConfigurationsElement.Element("TenantConfigurations").Elements("TenantConfiguration")) { TenantConfiguration config = new TenantConfiguration(); config.TenantName = (string)tenantConfigurationElement.Element("TenantName"); config.AccountName = (string)tenantConfigurationElement.Element("AccountName"); config.AccountKey = (string)tenantConfigurationElement.Element("AccountKey"); config.BlobServiceEndpoint = (string)tenantConfigurationElement.Element("BlobServiceEndpoint"); config.FileServiceEndpoint = (string)tenantConfigurationElement.Element("FileServiceEndpoint"); config.QueueServiceEndpoint = (string)tenantConfigurationElement.Element("QueueServiceEndpoint"); config.TableServiceEndpoint = (string)tenantConfigurationElement.Element("TableServiceEndpoint"); config.BlobServiceSecondaryEndpoint = (string)tenantConfigurationElement.Element("BlobServiceSecondaryEndpoint"); config.QueueServiceSecondaryEndpoint = (string)tenantConfigurationElement.Element("QueueServiceSecondaryEndpoint"); config.TableServiceSecondaryEndpoint = (string)tenantConfigurationElement.Element("TableServiceSecondaryEndpoint"); config.TenantType = (TenantType)Enum.Parse(typeof(TenantType), (string)tenantConfigurationElement.Element("TenantType"), true); tenantConfigurationList.Add(config); } result.TenantConfigurations = tenantConfigurationList; return(result); }
private static void Initialize(TestConfigurations configurations) { TestBase.TargetTenantConfig = configurations.TenantConfigurations.Single(config => config.TenantName == configurations.TargetTenantName); TestBase.StorageCredentials = new StorageCredentials(TestBase.TargetTenantConfig.AccountName, TestBase.TargetTenantConfig.AccountKey); TestBase.CurrentTenantType = TargetTenantConfig.TenantType; #if WINDOWS_DESKTOP System.Threading.ThreadPool.SetMinThreads(100, 100); #endif }
static TestBase() { StorageFile xmlFile = Package.Current.InstalledLocation.GetFileAsync(TestConfigurations.DefaultTestConfigFilePath).AsTask().Result; XmlDocument xmlDoc = XmlDocument.LoadFromFileAsync(xmlFile).AsTask().Result; XDocument doc = XDocument.Parse(xmlDoc.GetXml()); TestConfigurations configurations = TestConfigurations.ReadFromXml(doc); TestBase.Initialize(configurations); }
/// <summary> /// Initialize unit tests with configuration /// </summary> static TestBase() { XElement element; using (var stream = new FileStream(TestConfigurations.DefaultTestConfigFilePath, FileMode.Open)) { element = XElement.Load(stream); } TestConfigurations configurations = TestConfigurations.ReadFromXml(element); TestBase.Initialize(configurations); }
static TestBase() { try { XElement element = XElement.Load(TestConfigurations.DefaultTestConfigFilePath); TestConfigurations configurations = TestConfigurations.ReadFromXml(element); TestBase.Initialize(configurations); } catch (System.IO.FileNotFoundException) { throw new System.IO.FileNotFoundException("To run tests you need to supply a TestConfigurations.xml file with credentials in the Test/Common folder. Use TestConfigurationsTemplate.xml as a template."); } }
private static void Initialize(TestConfigurations configurations) { TestBase.TargetTenantConfig = configurations.TenantConfigurations.Single(config => config.TenantName == configurations.TargetTenantName); TestBase.StorageCredentials = new StorageCredentials(TestBase.TargetTenantConfig.AccountName, TestBase.TargetTenantConfig.AccountKey); TestBase.CurrentTenantType = TargetTenantConfig.TenantType; try { TestBase.PremiumBlobTenantConfig = configurations.TenantConfigurations.Single(config => config.TenantName == configurations.TargetPremiumBlobTenantName); TestBase.PremiumBlobStorageCredentials = new StorageCredentials(TestBase.PremiumBlobTenantConfig.AccountName, TestBase.PremiumBlobTenantConfig.AccountKey); } catch (InvalidOperationException) { } #if WINDOWS_DESKTOP System.Threading.ThreadPool.SetMinThreads(100, 100); #endif }
static TestBase() { try { StorageFile xmlFile = Package.Current.InstalledLocation.GetFileAsync(TestConfigurations.DefaultTestConfigFilePath).AsTask().Result; XmlDocument xmlDoc = XmlDocument.LoadFromFileAsync(xmlFile).AsTask().Result; XDocument doc = XDocument.Parse(xmlDoc.GetXml()); TestConfigurations configurations = TestConfigurations.ReadFromXml(doc); TestBase.Initialize(configurations); } catch (System.IO.FileNotFoundException) { throw new System.IO.FileNotFoundException("To run tests you need to supply a TestConfigurations.xml file with credentials in the Test/Common folder. Use TestConfigurationsTemplate.xml as a template."); } }
static TestBase() { XElement element = XElement.Load(TestConfigurations.DefaultTestConfigFilePath); TestConfigurations = TestConfigurations.ReadFromXml(element); foreach (var tenant in TestConfigurations.TenantConfigurations) { if (tenant.TenantName == TestConfigurations.TargetTenantName) { TargetTenantConfig = tenant; break; } } StorageCredentials = new StorageCredentials(TargetTenantConfig.AccountName, TargetTenantConfig.AccountKey); CurrentTenantType = TargetTenantConfig.TenantType; }
static TestBase() { StorageFile xmlFile = Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(TestConfigurations.DefaultTestConfigFilePath).AsTask().Result; XmlDocument xmlDoc = XmlDocument.LoadFromFileAsync(xmlFile).AsTask().Result; XDocument doc = XDocument.Parse(xmlDoc.GetXml()); TestConfigurations = TestConfigurations.ReadFromXml(doc); foreach (TenantConfiguration tenant in TestConfigurations.TenantConfigurations) { if (tenant.TenantName == TestConfigurations.TargetTenantName) { TargetTenantConfig = tenant; break; } } StorageCredentials = new StorageCredentials(TestBase.TargetTenantConfig.AccountName, TestBase.TargetTenantConfig.AccountKey); CurrentTenantType = TargetTenantConfig.TenantType; }
private static void Initialize(TestConfigurations configurations) { TestBase.TargetTenantConfig = configurations.TenantConfigurations.Single(config => config.TenantName == configurations.TargetTenantName); TestBase.StorageCredentials = new StorageCredentials(TestBase.TargetTenantConfig.AccountName, TestBase.TargetTenantConfig.AccountKey); TestBase.CurrentTenantType = TargetTenantConfig.TenantType; }