public async Task GetShouldReturnDatabasesFromCacheIfGetCalledTwice()
        {
            Dictionary <string, List <string> > subscriptionToDatabaseMap = CreateSubscriptonMap(2);

            AddDatabases(subscriptionToDatabaseMap, 3);

            AzureDatabaseDiscoveryProvider         databaseDiscoveryProvider = FakeDataFactory.CreateAzureDatabaseDiscoveryProvider(subscriptionToDatabaseMap);
            ServiceResponse <DatabaseInstanceInfo> response = await databaseDiscoveryProvider.GetDatabaseInstancesAsync(serverName : null, cancellationToken : new CancellationToken());

            List <DatabaseInstanceInfo> list = response.Data.ToList();

            ValidateResult(subscriptionToDatabaseMap, list);

            Dictionary <string, List <string> > subscriptionToDatabaseMap2 = CopySubscriptonMap(subscriptionToDatabaseMap);

            AddDatabases(subscriptionToDatabaseMap2, 5);
            AzureTestContext testContext = new AzureTestContext(subscriptionToDatabaseMap2);

            databaseDiscoveryProvider.AccountManager       = testContext.AzureAccountManager;
            databaseDiscoveryProvider.AzureResourceManager = testContext.AzureResourceManager;
            response = await databaseDiscoveryProvider.GetDatabaseInstancesAsync(serverName : null, cancellationToken : new CancellationToken());

            list = response.Data.ToList();
            //the provider should get the databases from cache for the list should match the first created data
            ValidateResult(subscriptionToDatabaseMap, list);
        }
        private void ValidateResult(Dictionary <string, List <string> > subscriptionToDatabaseMap, List <DatabaseInstanceInfo> result)
        {
            Assert.NotNull(result);
            int numberOfDatabases = 0;

            foreach (KeyValuePair <string, List <string> > item in subscriptionToDatabaseMap)
            {
                numberOfDatabases += item.Value.Count;
                foreach (string databaseFullName in item.Value)
                {
                    string serverName   = AzureTestContext.GetServerName(databaseFullName);
                    string databaseName = databaseFullName.Replace(serverName + @"/", "");
                    Assert.True(result.Any(x => x.Name == databaseName && x.ServerInstanceInfo.Name == serverName));
                }
            }
            Assert.True(result.Count() == numberOfDatabases);
        }