Beispiel #1
0
        public DishRepositoryTests(StartupFixture startup)
        {
            _provider            = startup.Provider;
            _dishRepository      = (IDishRepository)_provider.GetService(typeof(IDishRepository));
            _dishQueryRepository = (IDishQueryRepository)_provider.GetService(typeof(IDishQueryRepository));
            var client = (CosmosClient)_provider.GetService(typeof(CosmosClient));
            var config = (IConfiguration)_provider.GetService(typeof(IConfiguration));
            var dbName = config.GetValue <string>("CosmosDb:Database");

            // ignore the risk of using .Result as we're in a test harness and just ensuring that the container exists befopre each test
            var dbResponse = client.CreateDatabaseIfNotExistsAsync(dbName).Result;
            var db         = dbResponse.Database;
            var result     = db.CreateContainerIfNotExistsAsync(new ContainerProperties(DishRepository.CONTAINER, $"/partitionKey")).Result;

            _container = client.GetContainer(dbName, DishRepository.CONTAINER);
        }
Beispiel #2
0
 public DishesGet(ILogger <DishCreate> logger, IDishQueryRepository dishRepository, IAuthzService authz)
 {
     _logger         = logger;
     _dishRepository = dishRepository;
     _authz          = authz;
 }