Skip to content

Commit dd8714c

Browse files
authored
Merge pull request #13 from managed-code-hub/tests-review
Tests review
2 parents 6febe30 + 9cd3047 commit dd8714c

4 files changed

Lines changed: 382 additions & 27 deletions

File tree

ManagedCode.Storage.Azure/AzureStorage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ public async Task UploadAsync(BlobMetadata blobMetadata, byte[] data, Cancellati
227227

228228
public async Task<string> UploadAsync(string content, CancellationToken cancellationToken = default)
229229
{
230-
string fileName = Guid.NewGuid().ToString("N").ToLowerInvariant();
230+
string fileName = $"{Guid.NewGuid().ToString("N").ToLowerInvariant()}.txt";
231231

232-
var blobClient = _blobContainerClient.GetBlobClient($"{fileName}.txt");
232+
var blobClient = _blobContainerClient.GetBlobClient(fileName);
233233
await blobClient.UploadAsync(BinaryData.FromString(content), cancellationToken);
234234

235235
return fileName;

ManagedCode.Storage.Core/LocalFile.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ public void Close()
130130
}
131131
}
132132

133-
public static async Task<LocalFile> FromStream(Stream stream)
133+
public static async Task<LocalFile> FromStreamAsync(Stream stream)
134134
{
135135
var file = new LocalFile();
136136
await stream.CopyToAsync(file.FileStream);
137-
await file.DisposeAsync();
138-
file.Close();
137+
file.FileStream.Dispose();
138+
139139
return file;
140140
}
141141
}

ManagedCode.Storage.Tests/Azure/AzureStorageTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ protected override ServiceProvider ConfigureServices()
3232
{
3333
Container = "managed-code-bucket",
3434
ConnectionString =
35-
"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://localhost:10000/devstoreaccount1;QueueEndpoint=http://localhost:10001/devstoreaccount1;TableEndpoint=http://localhost:10002/devstoreaccount1;",
36-
});
35+
"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://localhost:10000/devstoreaccount1;QueueEndpoint=http://localhost:10001/devstoreaccount1;TableEndpoint=http://localhost:10002/devstoreaccount1;",
36+
});
3737
return services.BuildServiceProvider();
3838
}
3939

0 commit comments

Comments
 (0)