public async void CheckAllContractsAvailability()
{
SimpleIoc.Default.Register<IConfigService, ConfigService>();
var contractService = new ContractService(null, new StorageService());
var failFlag = false;
int failCounter = 0;
int counter = 0;
await contractService.GetCountries().SelectAsync(async country =>
{
await country.Contracts.SelectAsync(async contract =>
{
counter++;
try
{
var stations = await contract.GetStationsAsync();
Assert.Greater(stations.Count, 0);
if (stations.Count == 0)
{
failCounter++;
}
if (stations.Count > 0)
{
Assert.AreNotEqual(stations.FirstOrDefault().Latitude, 0);
if (stations.FirstOrDefault().Latitude == 0)
failCounter++;
}
}
catch (Exception e)
{
failFlag = true;
failCounter++;
Debug.WriteLine("FAILED : " + contract.Name + " (" + contract.ServiceProvider + " / " + country + ") : " + e.Message);
}
return true;
});
return true;
});
Debug.WriteLine("FAILED " + failCounter + " / " + counter);
Assert.IsFalse(failFlag);
}