Пример #1
0
 public void GetTestStatisticsSuccessTest()
 {
     using (var db = GetContext())
     {
         var service = new CovidTestService(db);
         var stat    = service.GetTestStatistics();
         Assert.True(stat.Count() == 16);
     }
 }
Пример #2
0
        private static async Task <CovidTestService> InitializeCosmosClientForCovidTestsInstanceAsync(IConfigurationSection configurationSection)
        {
            string databaseName  = configurationSection.GetSection("DatabaseName").Value;
            string containerName = configurationSection.GetSection("ContainerName").Value;
            string account       = configurationSection.GetSection("Account").Value;
            string key           = configurationSection.GetSection("Key").Value;
            //Microsoft.Azure.Cosmos.CosmosClient
            CosmosClient     client           = new CosmosClient(account, key);
            CovidTestService covidTestService = new CovidTestService(client, databaseName, containerName);
            //Microsoft.Azure.Cosmos.DatabaseResponse
            DatabaseResponse database = await client.CreateDatabaseIfNotExistsAsync(databaseName);

            await database.Database.CreateContainerIfNotExistsAsync(containerName, "/id");

            return(covidTestService);
        }