Skip to content

Commit dbcae3a

Browse files
committed
Adding Azure CacheFolder tests
1 parent 408610b commit dbcae3a

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) Six Labors.
2+
// Licensed under the Six Labors Split License.
3+
4+
using SixLabors.ImageSharp.Web.Tests.TestUtilities;
5+
using Xunit.Abstractions;
6+
7+
namespace SixLabors.ImageSharp.Web.Tests.Processing;
8+
9+
public class AzureBlobStorageCacheCacheFolderServerTests : ServerTestBase<AzureBlobStorageCacheCacheFolderTestServerFixture>
10+
{
11+
public AzureBlobStorageCacheCacheFolderServerTests(AzureBlobStorageCacheCacheFolderTestServerFixture fixture, ITestOutputHelper outputHelper)
12+
: base(fixture, outputHelper, TestConstants.AzureTestImage)
13+
{
14+
}
15+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) Six Labors.
2+
// Licensed under the Six Labors Split License.
3+
4+
using Azure.Storage.Blobs.Models;
5+
using Microsoft.Extensions.DependencyInjection;
6+
using SixLabors.ImageSharp.Web.Caching.Azure;
7+
using SixLabors.ImageSharp.Web.DependencyInjection;
8+
using SixLabors.ImageSharp.Web.Providers.Azure;
9+
10+
namespace SixLabors.ImageSharp.Web.Tests.TestUtilities;
11+
12+
public class AzureBlobStorageCacheCacheFolderTestServerFixture : TestServerFixture
13+
{
14+
protected override void ConfigureCustomServices(IServiceCollection services, IImageSharpBuilder builder)
15+
=> builder
16+
.Configure<AzureBlobStorageImageProviderOptions>(o =>
17+
o.BlobContainers.Add(
18+
new AzureBlobContainerClientOptions
19+
{
20+
ConnectionString = TestConstants.AzureConnectionString,
21+
ContainerName = TestConstants.AzureContainerName
22+
}))
23+
.AddProvider(AzureBlobStorageImageProviderFactory.Create)
24+
.Configure<AzureBlobStorageCacheOptions>(o =>
25+
{
26+
o.ConnectionString = TestConstants.AzureConnectionString;
27+
o.ContainerName = TestConstants.AzureCacheContainerName;
28+
o.CacheFolder = TestConstants.AzureCacheFolder;
29+
30+
AzureBlobStorageCache.CreateIfNotExists(o, PublicAccessType.None);
31+
})
32+
.SetCache<AzureBlobStorageCache>();
33+
}

tests/ImageSharp.Web.Tests/TestUtilities/TestConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public static class TestConstants
88
public const string AzureConnectionString = "UseDevelopmentStorage=true";
99
public const string AzureContainerName = "azure";
1010
public const string AzureCacheContainerName = "is-cache";
11+
public const string AzureCacheFolder = "cache/folder";
1112
public const string AWSEndpoint = "http://localhost:4568/";
1213
public const string AWSRegion = "eu-west-2";
1314
public const string AWSBucketName = "aws";

0 commit comments

Comments
 (0)