public TestFixture() { IHost host = new HostBuilder() .ConfigureDefaultTestHost(b => { b.AddAzureStorage(); }) .Build(); var accountProvider = host.Services.GetService <StorageAccountProvider>(); var task = accountProvider.GetHost(); CloudQueueClient client = task.CreateCloudQueueClient(); QueueClient = client; string queueName = string.Format("{0}-{1}", TestQueuePrefix, Guid.NewGuid()); Queue = client.GetQueueReference(queueName); Queue.CreateIfNotExistsAsync(CancellationToken.None).Wait(); string poisonQueueName = string.Format("{0}-poison", queueName); PoisonQueue = client.GetQueueReference(poisonQueueName); PoisonQueue.CreateIfNotExistsAsync(CancellationToken.None).Wait(); }
public TestFixture() { IHost host = new HostBuilder() .ConfigureDefaultTestHost(b => { b.AddAzureStorageBlobs().AddAzureStorageQueues(); }) .Build(); var accountProvider = host.Services.GetService <StorageAccountProvider>(); var task = accountProvider.GetHost(); QueueServiceClient client = task.CreateQueueServiceClient(); QueueClient = client; string queueName = string.Format("{0}-{1}", TestQueuePrefix, Guid.NewGuid()); Queue = client.GetQueueClient(queueName); Queue.CreateIfNotExists(); string poisonQueueName = string.Format("{0}-poison", queueName); PoisonQueue = client.GetQueueClient(poisonQueueName); PoisonQueue.CreateIfNotExists(); }
public TestFixture() { DefaultStorageAccountProvider accountProvider = new DefaultStorageAccountProvider(); var task = accountProvider.GetStorageAccountAsync(CancellationToken.None); task.Wait(); IStorageQueueClient client = task.Result.CreateQueueClient(); QueueClient = client.SdkObject; string queueName = string.Format("{0}-{1}", TestQueuePrefix, Guid.NewGuid()); Queue = client.GetQueueReference(queueName).SdkObject; Queue.CreateIfNotExistsAsync(CancellationToken.None).Wait(); string poisonQueueName = string.Format("{0}-poison", queueName); PoisonQueue = client.GetQueueReference(poisonQueueName).SdkObject; PoisonQueue.CreateIfNotExistsAsync(CancellationToken.None).Wait(); }
public TestFixture() { Mock <IServiceProvider> services = new Mock <IServiceProvider>(MockBehavior.Strict); StorageClientFactory clientFactory = new StorageClientFactory(); services.Setup(p => p.GetService(typeof(StorageClientFactory))).Returns(clientFactory); DefaultStorageAccountProvider accountProvider = new DefaultStorageAccountProvider(services.Object); var task = accountProvider.GetStorageAccountAsync(CancellationToken.None); IStorageQueueClient client = task.Result.CreateQueueClient(); QueueClient = client.SdkObject; string queueName = string.Format("{0}-{1}", TestQueuePrefix, Guid.NewGuid()); Queue = client.GetQueueReference(queueName).SdkObject; Queue.CreateIfNotExistsAsync(null, null, CancellationToken.None).Wait(); string poisonQueueName = string.Format("{0}-poison", queueName); PoisonQueue = client.GetQueueReference(poisonQueueName).SdkObject; PoisonQueue.CreateIfNotExistsAsync(null, null, CancellationToken.None).Wait(); }
public TestFixture() { // Create a default host to get some default services IHost host = new HostBuilder() .ConfigureDefaultTestHost(b => { b.AddAzureStorage(); }) .Build(); var storageAccount = host.GetStorageAccount(); QueueClient = storageAccount.CreateCloudQueueClient(); string queueName = string.Format("{0}-{1}", TestQueuePrefix, Guid.NewGuid()); Queue = QueueClient.GetQueueReference(queueName); Queue.CreateIfNotExistsAsync(null, null, CancellationToken.None).Wait(); string poisonQueueName = string.Format("{0}-poison", queueName); PoisonQueue = QueueClient.GetQueueReference(poisonQueueName); PoisonQueue.CreateIfNotExistsAsync(null, null, CancellationToken.None).Wait(); }