public void CapacityBasedShouldFromAccountsShouldFilterBasedOnInputArray()
        {
            List <IStorageAccount> storageAccountList = GetStorageAccountList(_fourStorageAccountNameArray, _evenBytesUsedValues);

            // Copy 3 of the 4 names to the filter array
            string[] filterArray = new string[_fourStorageAccountNameArray.Length - 1];
            Array.Copy(_fourStorageAccountNameArray, filterArray, filterArray.Length);

            // save the name of the skipped entry
            string nameSkipped = _fourStorageAccountNameArray[_fourStorageAccountNameArray.Length - 1];

            // Create the CapacityBasedAccountSelectionStrategy
            MediaContextBase context = GetMediaContextBase(storageAccountList);
            CapacityBasedAccountSelectionStrategy strategy = CapacityBasedAccountSelectionStrategy.FromAccounts(context, maximumStorageAccountCapacity: oneGB, storageAccountNames: filterArray);

            // Now ensure that the internal list only has the expected number of entries.
            IList <CapacityBasedAccountSelectionStrategyListEntry> accountListFromStrategy = strategy.GetStorageAccounts();

            Assert.AreEqual(filterArray.Length, accountListFromStrategy.Count);

            foreach (CapacityBasedAccountSelectionStrategyListEntry entry in accountListFromStrategy)
            {
                Assert.AreNotEqual(nameSkipped, entry.StorageAccount.Name);
            }

            // Add the name previously skipped
            strategy.AddStorageAccountByName(nameSkipped, false, oneGB);

            VerifyStrategyEntriesMatchExpectations(storageAccountList, strategy, oneGB, false);

            // Now verify that if I have names in the filter array that don't exist in the account no exception occurs
            strategy = CapacityBasedAccountSelectionStrategy.FromAccounts(context, maximumStorageAccountCapacity: oneGB, storageAccountNames: _fiveStorageAccountNameArray);
            VerifyStrategyEntriesMatchExpectations(storageAccountList, strategy, oneGB, false);
        }
        private void VerifyStrategyEntriesMatchExpectations(List <IStorageAccount> expectedList, CapacityBasedAccountSelectionStrategy strategy, long maximumStorageAccountCapacity, bool considerFullCapacityIfNoDataAvailable)
        {
            IList <CapacityBasedAccountSelectionStrategyListEntry> accountListFromStrategy = strategy.GetStorageAccounts();

            Assert.AreEqual(expectedList.Count, accountListFromStrategy.Count);

            foreach (CapacityBasedAccountSelectionStrategyListEntry entry in accountListFromStrategy)
            {
                IStorageAccount accountFromExpectedList = expectedList.Where(st => st.Name == entry.StorageAccount.Name).SingleOrDefault();

                long expectedAvailableCapacity = CalculateExpectedAvailableCapacity(accountFromExpectedList.BytesUsed, maximumStorageAccountCapacity, considerFullCapacityIfNoDataAvailable);

                Assert.AreEqual(accountFromExpectedList.Name, entry.StorageAccount.Name);
                Assert.AreEqual(accountFromExpectedList.BytesUsed, entry.StorageAccount.BytesUsed);
                Assert.AreEqual(expectedAvailableCapacity, entry.AvailableCapacity);
            }
        }
        private void VerifyStrategyEntriesMatchExpectations(List<IStorageAccount> expectedList, CapacityBasedAccountSelectionStrategy strategy, long maximumStorageAccountCapacity, bool considerFullCapacityIfNoDataAvailable)
        {
            IList<CapacityBasedAccountSelectionStrategyListEntry> accountListFromStrategy = strategy.GetStorageAccounts();
            Assert.AreEqual(expectedList.Count, accountListFromStrategy.Count);

            foreach (CapacityBasedAccountSelectionStrategyListEntry entry in accountListFromStrategy)
            {
                IStorageAccount accountFromExpectedList = expectedList.Where(st => st.Name == entry.StorageAccount.Name).SingleOrDefault();

                long expectedAvailableCapacity = CalculateExpectedAvailableCapacity(accountFromExpectedList.BytesUsed, maximumStorageAccountCapacity, considerFullCapacityIfNoDataAvailable);

                Assert.AreEqual(accountFromExpectedList.Name, entry.StorageAccount.Name);
                Assert.AreEqual(accountFromExpectedList.BytesUsed, entry.StorageAccount.BytesUsed);
                Assert.AreEqual(expectedAvailableCapacity, entry.AvailableCapacity);
            }
        }