From 36da221444807742a9e26f2ba636d9c6aef6155f Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Sun, 4 Aug 2019 15:46:31 +0800 Subject: Continue to add unit tests for token. Fix a bug thanks to unit test. --- Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs') diff --git a/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs b/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs index a7616b41..aa005ba3 100644 --- a/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs +++ b/Timeline.Tests/Helpers/WebApplicationFactoryExtensions.cs @@ -1,9 +1,11 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; +using Microsoft.AspNetCore.TestHost; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Timeline.Models; +using Timeline.Services; using Xunit.Abstractions; namespace Timeline.Tests.Helpers @@ -46,6 +48,10 @@ namespace Timeline.Tests.Helpers db.Users.AddRange(TestMockUsers.MockUsers); db.SaveChanges(); } + }) + .ConfigureTestServices(services => + { + services.AddSingleton(); }); }); } -- cgit v1.2.3