aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/QCloudCosServiceUnitTest.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-04-25 19:03:46 +0800
committercrupest <crupest@outlook.com>2019-04-25 19:03:46 +0800
commit1affca9259fc3178595e4dfdf2389977110c8f74 (patch)
tree281940ee054383182e509643279b90e9b5c3ca33 /Timeline.Tests/QCloudCosServiceUnitTest.cs
parent40a1e1d96940ae005db6467cd4207b25d6261837 (diff)
downloadtimeline-1affca9259fc3178595e4dfdf2389977110c8f74.tar.gz
timeline-1affca9259fc3178595e4dfdf2389977110c8f74.tar.bz2
timeline-1affca9259fc3178595e4dfdf2389977110c8f74.zip
Rename the cos service file. Fix a bug in test.
Diffstat (limited to 'Timeline.Tests/QCloudCosServiceUnitTest.cs')
-rw-r--r--Timeline.Tests/QCloudCosServiceUnitTest.cs7
1 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);