public void ShouldThrowCreatingStrategyIfStorageAccountsArrayIsNull() { // Defining list of accounts to select from. string[] nullStorageAccountNames = null; IAccountSelectionStrategy strategy = new RandomAccountSelectionStrategy(nullStorageAccountNames); }
public void ShouldRedistributeCreationOfAssetBetweenAllStorageAccounts() { // Defining list of accounts to select from. string[] storageAccountNames = new[] { "account1", "account2", "account3" }; IAccountSelectionStrategy selectionStrategy = new RandomAccountSelectionStrategy(storageAccountNames); var selectedStorageAccounts = new Dictionary<string, int>(); for (int i = 0; i < 50; i++) { var selectedStorageAccount = selectionStrategy.SelectAccountForAsset(); if (!selectedStorageAccounts.ContainsKey(selectedStorageAccount)) { selectedStorageAccounts.Add(selectedStorageAccount, 0); } else { selectedStorageAccounts[selectedStorageAccount] += 1; } Thread.Sleep(100); } // Check if all storage accounts participated in redistribution. Assert.AreEqual(storageAccountNames.Length, selectedStorageAccounts.Keys.Count); }