Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: 'Setup .NET'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'
dotnet-version: '10.0.x'
- name: 'Run tests'
run: dotnet test --configuration Release

Expand Down
31 changes: 0 additions & 31 deletions Adliance.AzureBlobSimulator.sln

This file was deleted.

10 changes: 10 additions & 0 deletions Adliance.AzureBlobSimulator.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Solution>
<Folder Name="/Solution Items/">
<File Path=".gitignore" />
<File Path="docker-build-push.yml" />
<File Path="dockerfile" />
<File Path="README.md" />
</Folder>
<Project Path="src/Adliance.AzureBlobSimulator/Adliance.AzureBlobSimulator.csproj" />
<Project Path="test/Adliance.AzureBlobSimulator.Tests/Adliance.AzureBlobSimulator.Tests.csproj" />
</Solution>
21 changes: 9 additions & 12 deletions src/Adliance.AzureBlobSimulator/Adliance.AzureBlobSimulator.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Adliance.Buddy.CodeStyle" Version="8.0.0.10" />
</ItemGroup>

</Project>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Adliance.Buddy.CodeStyle" Version="8.0.0.10" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Adliance.Buddy.CodeStyle" Version="8.0.0.10" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.27.0" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PackageReference Include="coverlet.collector" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.7" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="Testcontainers" Version="4.10.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.3">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Adliance.AzureBlobSimulator\Adliance.AzureBlobSimulator.csproj" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public async Task Can_Get_Properties_of_Blob()
var containerPath = Path.Combine(TestStoragePath, containerName);
Directory.CreateDirectory(containerPath);
await File.WriteAllBytesAsync(Path.Combine(containerPath, blobName), "Hello World!"u8.ToArray());
;

var containerClient = BlobServiceClient.GetBlobContainerClient(containerName);
var blobClient = containerClient.GetBlobClient(blobName);
Expand Down
4 changes: 2 additions & 2 deletions test/Adliance.AzureBlobSimulator.Tests/E2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public async Task E2E_UploadAndDownloadBlob_ShouldSucceed()
var blob = container.GetBlockBlobClient("file.txt");
const string txt = "This is a E2E test file which should be uploaded and downloaded by the simulator.";
using var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(txt));
await blob.UploadAsync(stream);
await blob.UploadAsync(stream, cancellationToken: cts.Token);

var result = await blob.DownloadContentAsync();
var result = await blob.DownloadContentAsync(cts.Token);
Assert.Equal(txt, result.Value.Content.ToString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;

namespace Adliance.AzureBlobSimulator.Tests.SharedAccessSignature;
Expand All @@ -20,41 +21,47 @@ public class SasAuthenticationMiddlewareTests

public SasAuthenticationMiddlewareTests()
{
var builder = new WebHostBuilder()
.ConfigureServices(services =>
var host = new HostBuilder()
.ConfigureWebHost(webBuilder =>
{
services.Configure<StorageOptions>(options =>
{
options.Accounts =
[
new StorageAccountOptions
webBuilder
.UseTestServer()
.ConfigureServices(services =>
{
services.Configure<StorageOptions>(options =>
{
Name = "testaccount",
Key = Convert.ToBase64String(
Encoding.UTF8.GetBytes("1234567890123456"))
}
];
});

services.AddSingleton<SasValidatorService>();
})
.Configure(app =>
{
app.UseMiddleware<SasAuthenticationMiddleware>();
options.Accounts =
[
new StorageAccountOptions
{
Name = "testaccount",
Key = Convert.ToBase64String(
Encoding.UTF8.GetBytes("1234567890123456"))
}
];
});

services.AddSingleton<SasValidatorService>();
})
.Configure(app =>
{
app.UseMiddleware<SasAuthenticationMiddleware>();

app.Run(context =>
{
context.Response.StatusCode = 200;
return Task.CompletedTask;
});
});
app.Run(context =>
{
context.Response.StatusCode = 200;
return Task.CompletedTask;
});
});
})
.Start();

var server = new TestServer(builder);
_client = server.CreateClient();
_client = host.GetTestClient();

var options = host.Services.GetRequiredService<IOptions<StorageOptions>>();
var env = new TestHostEnvironment();
var options = server.Services.GetRequiredService<IOptions<StorageOptions>>();
var validator = new SasValidatorService(options, null, env);

_sasHelper = new SasHelper(options, validator);
}

Expand Down
Loading