Skip to content

Commit f589063

Browse files
committed
fix all tests
1 parent bf2ae5c commit f589063

19 files changed

+45
-42
lines changed

ManagedCode.Storage.Tests/ManagedCode.Storage.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<ProjectReference Include="..\ManagedCode.Storage.FileSystem\ManagedCode.Storage.FileSystem.csproj" />
5656
<ProjectReference Include="..\ManagedCode.Storage.Google\ManagedCode.Storage.Google.csproj" />
5757
<ProjectReference Include="..\ManagedCode.Storage.TestFakes\ManagedCode.Storage.TestFakes.csproj" />
58-
<ProjectReference Include="..\Testcontainers.GCS\Testcontainers.GCS.csproj" />
58+
<ProjectReference Include="..\TestcontainersGCS\TestcontainersGCS.csproj" />
5959
</ItemGroup>
6060

6161
</Project>

ManagedCode.Storage.Tests/Storages/Azure/AzureBlobTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ public class AzureBlobTests : BlobTests<AzuriteContainer>
77
{
88
protected override AzuriteContainer Build()
99
{
10-
return new AzuriteBuilder().Build();
10+
return new AzuriteBuilder()
11+
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.26.0")
12+
.Build();
1113
}
1214

1315
protected override ServiceProvider ConfigureServices()

ManagedCode.Storage.Tests/Storages/Azure/AzureConfigTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ public void BadConfigurationForStorage_WithoutConnectionString_ThrowException()
4545
[Fact]
4646
public void StorageAsDefaultTest()
4747
{
48-
var storage = AzureConfigurator.ConfigureServices("test").GetService<IAzureStorage>();
49-
var defaultStorage = AzureConfigurator.ConfigureServices("test").GetService<IStorage>();
48+
var connectionString = "UseDevelopmentStorage=true";
49+
var storage = AzureConfigurator.ConfigureServices(connectionString).GetService<IAzureStorage>();
50+
var defaultStorage = AzureConfigurator.ConfigureServices(connectionString).GetService<IStorage>();
5051
storage?.GetType().FullName.Should().Be(defaultStorage?.GetType().FullName);
5152
}
5253
}

ManagedCode.Storage.Tests/Storages/Azure/AzureConfigurator.cs

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
using Google.Cloud.Storage.V1;
2-
using ManagedCode.Storage.Google.Extensions;
3-
using ManagedCode.Storage.Google.Options;
1+
using ManagedCode.Storage.Azure.Extensions;
2+
using ManagedCode.Storage.Azure.Options;
43
using Microsoft.Extensions.DependencyInjection;
54

65
// ReSharper disable MethodHasAsyncOverload
@@ -14,32 +13,16 @@ public static ServiceProvider ConfigureServices(string connectionString)
1413

1514
var services = new ServiceCollection();
1615

17-
services.AddGCPStorageAsDefault(opt =>
16+
services.AddAzureStorageAsDefault(opt =>
1817
{
19-
opt.BucketOptions = new BucketOptions
20-
{
21-
ProjectId = "api-project-0000000000000",
22-
Bucket = "managed-code-bucket"
23-
};
24-
opt.StorageClientBuilder = new StorageClientBuilder
25-
{
26-
UnauthenticatedAccess = true,
27-
BaseUri = connectionString
28-
};
18+
opt.Container = "managed-code-bucket";
19+
opt.ConnectionString = connectionString;
2920
});
3021

31-
services.AddGCPStorage(new GCPStorageOptions
22+
services.AddAzureStorage(new AzureStorageOptions
3223
{
33-
BucketOptions = new BucketOptions
34-
{
35-
ProjectId = "api-project-0000000000000",
36-
Bucket = "managed-code-bucket"
37-
},
38-
StorageClientBuilder = new StorageClientBuilder
39-
{
40-
UnauthenticatedAccess = true,
41-
BaseUri = connectionString
42-
}
24+
Container = "managed-code-bucket",
25+
ConnectionString = connectionString
4326
});
4427
return services.BuildServiceProvider();
4528
}

ManagedCode.Storage.Tests/Storages/Azure/AzureContainerTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ public class AzureContainerTests : ContainerTests<AzuriteContainer>
77
{
88
protected override AzuriteContainer Build()
99
{
10-
return new AzuriteBuilder().Build();
10+
return new AzuriteBuilder()
11+
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.26.0")
12+
.Build();
1113
}
1214

1315
protected override ServiceProvider ConfigureServices()

ManagedCode.Storage.Tests/Storages/Azure/AzureDownloadTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ public class AzureDownloadTests : DownloadTests<AzuriteContainer>
77
{
88
protected override AzuriteContainer Build()
99
{
10-
return new AzuriteBuilder().Build();
10+
return new AzuriteBuilder()
11+
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.26.0")
12+
.Build();
1113
}
1214

1315
protected override ServiceProvider ConfigureServices()

ManagedCode.Storage.Tests/Storages/Azure/AzureUploadTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ public class AzureUploadTests : UploadTests<AzuriteContainer>
77
{
88
protected override AzuriteContainer Build()
99
{
10-
return new AzuriteBuilder().Build();
10+
return new AzuriteBuilder()
11+
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.26.0")
12+
.Build();
1113
}
1214

1315
protected override ServiceProvider ConfigureServices()

ManagedCode.Storage.Tests/Storages/ContainerTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public async Task RemoveContainer_ShouldBeSuccess()
4040
[Fact]
4141
public async Task GetFileListAsyncTest()
4242
{
43-
// await StreamUploadAsyncTest();
44-
// await ArrayUploadAsyncTest();
45-
// await StringUploadAsyncTest();
43+
await UploadTestFileAsync();
44+
await UploadTestFileAsync();
45+
await UploadTestFileAsync();
4646

4747
var files = await Storage.GetBlobMetadataListAsync().ToListAsync();
4848
files.Count.Should().BeGreaterOrEqualTo(3);

ManagedCode.Storage.Tests/Storages/GCS/GCSBlobTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
using Microsoft.Extensions.DependencyInjection;
2-
using Testcontainers.GCS;
2+
using TestcontainersGCS;
3+
using Xunit;
34

45
// ReSharper disable MethodHasAsyncOverload
56

67
namespace ManagedCode.Storage.Tests.Storages.GCS;
78

9+
[Collection("Google")]
810
public class GCSBlobTests : BlobTests<GCSContainer>
911
{
1012
protected override GCSContainer Build()

ManagedCode.Storage.Tests/Storages/GCS/GCSConfigTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace ManagedCode.Storage.Tests.Storages.GCS;
1313

14+
[Collection("Google")]
1415
public class GCSConfigTests
1516
{
1617
[Fact]

0 commit comments

Comments
 (0)