diff options
author | crupest <crupest@outlook.com> | 2019-04-25 19:03:46 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-04-25 19:03:46 +0800 |
commit | 1affca9259fc3178595e4dfdf2389977110c8f74 (patch) | |
tree | 281940ee054383182e509643279b90e9b5c3ca33 | |
parent | 40a1e1d96940ae005db6467cd4207b25d6261837 (diff) | |
download | timeline-1affca9259fc3178595e4dfdf2389977110c8f74.tar.gz timeline-1affca9259fc3178595e4dfdf2389977110c8f74.tar.bz2 timeline-1affca9259fc3178595e4dfdf2389977110c8f74.zip |
Rename the cos service file. Fix a bug in test.
-rw-r--r-- | Timeline.Tests/QCloudCosServiceUnitTest.cs | 7 | ||||
-rw-r--r-- | Timeline/Services/QCloudCosService.cs (renamed from Timeline/Services/TencentCloudCosService.cs) | 0 |
2 files changed, 4 insertions, 3 deletions
diff --git a/Timeline.Tests/QCloudCosServiceUnitTest.cs b/Timeline.Tests/QCloudCosServiceUnitTest.cs index b0e6a868..0940c70d 100644 --- a/Timeline.Tests/QCloudCosServiceUnitTest.cs +++ b/Timeline.Tests/QCloudCosServiceUnitTest.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Net; +using System.Net.Http; using System.Threading.Tasks; using Timeline.Services; using Timeline.Tests.Helpers; @@ -80,8 +81,6 @@ namespace Timeline.Tests } } - // Although this test does not pass on my archlunux system. But the GenerateObjectGetUrl actually works well. - // And I don't know why. [Fact] public async Task GenerateObjectGetUrlTest() { @@ -90,7 +89,9 @@ namespace Timeline.Tests var services = serviceScope.ServiceProvider; var service = services.GetRequiredService<IQCloudCosService>(); var url = service.GenerateObjectGetUrl("avatar", "__default"); - using (var client = _factory.CreateClient()) + // never use the following line! Because client created by factory can't access Internet. + //using (var client = _factory.CreateClient()) + using (var client = services.GetRequiredService<IHttpClientFactory>().CreateClient()) { var res = await client.GetAsync(url); Assert.Equal(HttpStatusCode.OK, res.StatusCode); diff --git a/Timeline/Services/TencentCloudCosService.cs b/Timeline/Services/QCloudCosService.cs index f4358714..f4358714 100644 --- a/Timeline/Services/TencentCloudCosService.cs +++ b/Timeline/Services/QCloudCosService.cs |