public static async Task AssertTableEntityDoesNotExistAsync(this StorageContextFixture fixture, string testContext, string partitionKey, string rowKey)
        {
            var result = await GetEntityAsync(fixture, testContext, partitionKey, rowKey);

            if (result.HttpStatusCode != 404)
            {
                throw new Exception("Retrieve should have returned 404, but did not");
            }
        }
        public static async Task AssertTableEntityExistsAsync(this StorageContextFixture fixture, string testContext, string partitionKey, string rowKey)
        {
            var result = await GetEntityAsync(fixture, testContext, partitionKey, rowKey);

            if (result.HttpStatusCode != 200)
            {
                throw new Exception("Entity retrieve did not return 200");
            }
        }
        private static TableResult GetEntity(StorageContextFixture fixture, string testContext, string partitionKey, string rowKey)
        {
            var tableName = fixture.TableAndContainerNames[testContext];
            var a         = CloudStorageAccount.Parse(fixture.ConnectionString);
            var c         = a.CreateCloudTableClient();

            var result = c.GetTableReference(tableName).Execute(TableOperation.Retrieve(partitionKey, rowKey));

            return(result);
        }
Ejemplo n.º 4
0
        public static void AssertBlobDoesNotExist(this StorageContextFixture fixture, string testContext, string blobPath)
        {
            var blobServiceClient = new BlobServiceClient(fixture.ConnectionString);
            var exists            = blobServiceClient.GetBlobContainerClient(fixture.TableAndContainerNames[testContext])
                                    .GetBlobClient(blobPath)
                                    .Exists();

            if (exists.Value)
            {
                throw new Exception($"Blob {blobPath} exists but should not");
            }
        }
Ejemplo n.º 5
0
        public static async Task AssertBlobExistsAsync(this StorageContextFixture fixture, string testContext, string blobPath)
        {
            var blobServiceClient = new BlobServiceClient(fixture.ConnectionString);
            var exists            = await blobServiceClient.GetBlobContainerClient(fixture.TableAndContainerNames[testContext])
                                    .GetBlobClient(blobPath)
                                    .ExistsAsync();

            if (!exists.Value)
            {
                throw new Exception($"Blob {blobPath} does not exist");
            }
        }