diff --git a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/AccountControllerTests.cs b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/AccountControllerTests.cs index 1653485b2..3cbdd2843 100644 --- a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/AccountControllerTests.cs +++ b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/AccountControllerTests.cs @@ -2,24 +2,21 @@ using System.Collections.Generic; using System.Linq; using System.Net; -using System.Net.Http; using System.Threading.Tasks; using FluentAssertions; using HtmlAgilityPack; using Microsoft.AspNetCore.Mvc.Testing; using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Common; using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Mocks; +using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests.Base; using Xunit; namespace Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests { - public class AccountControllerTests : IClassFixture> + public class AccountControllerTests : BaseClassFixture { - private readonly HttpClient _client; - - public AccountControllerTests(WebApplicationFactory factory) + public AccountControllerTests(WebApplicationFactory factory) : base(factory) { - _client = factory.SetupClient(); } [Fact] diff --git a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/Base/BaseClassFixture.cs b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/Base/BaseClassFixture.cs new file mode 100644 index 000000000..5fdf6c564 --- /dev/null +++ b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/Base/BaseClassFixture.cs @@ -0,0 +1,17 @@ +using System.Net.Http; +using Microsoft.AspNetCore.Mvc.Testing; +using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Common; +using Xunit; + +namespace Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests.Base +{ + public class BaseClassFixture : IClassFixture> + { + protected readonly HttpClient _client; + + public BaseClassFixture(WebApplicationFactory factory) + { + _client = factory.SetupClient(); + } + } +} \ No newline at end of file diff --git a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/DiagnosticsControllerTests.cs b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/DiagnosticsControllerTests.cs index 4d46d437e..049a2c186 100644 --- a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/DiagnosticsControllerTests.cs +++ b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/DiagnosticsControllerTests.cs @@ -1,20 +1,16 @@ using System.Net; -using System.Net.Http; using System.Threading.Tasks; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; -using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Common; +using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests.Base; using Xunit; namespace Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests { - public class DiagnosticsControllerTests : IClassFixture> + public class DiagnosticsControllerTests : BaseClassFixture { - private readonly HttpClient _client; - - public DiagnosticsControllerTests(WebApplicationFactory factory) + public DiagnosticsControllerTests(WebApplicationFactory factory) : base(factory) { - _client = factory.SetupClient(); } [Fact] diff --git a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/GrantsControllerTests.cs b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/GrantsControllerTests.cs index 0126ffb70..f1a1f457c 100644 --- a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/GrantsControllerTests.cs +++ b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/GrantsControllerTests.cs @@ -1,21 +1,18 @@ using System.Net; -using System.Net.Http; using System.Threading.Tasks; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Common; using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Mocks; +using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests.Base; using Xunit; namespace Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests { - public class GrantsControllerTests : IClassFixture> + public class GrantsControllerTests : BaseClassFixture { - private readonly HttpClient _client; - - public GrantsControllerTests(WebApplicationFactory factory) + public GrantsControllerTests(WebApplicationFactory factory) : base(factory) { - _client = factory.SetupClient(); } [Fact] diff --git a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/HomeControllerTests.cs b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/HomeControllerTests.cs index db00a321d..281eae6b2 100644 --- a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/HomeControllerTests.cs +++ b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/HomeControllerTests.cs @@ -1,20 +1,16 @@ using System.Net; -using System.Net.Http; using System.Threading.Tasks; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; -using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Common; +using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests.Base; using Xunit; namespace Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests { - public class HomeControllerTests : IClassFixture> + public class HomeControllerTests : BaseClassFixture { - private readonly HttpClient _client; - - public HomeControllerTests(WebApplicationFactory factory) + public HomeControllerTests(WebApplicationFactory factory) : base(factory) { - _client = factory.SetupClient(); } [Fact] diff --git a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/IdentityServerTests.cs b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/IdentityServerTests.cs index a4a5d12e4..a7ad22463 100644 --- a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/IdentityServerTests.cs +++ b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/IdentityServerTests.cs @@ -1,27 +1,23 @@ -using System.Net.Http; -using System.Threading.Tasks; +using System.Threading.Tasks; using FluentAssertions; using IdentityModel.Client; using Microsoft.AspNetCore.Mvc.Testing; -using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Common; +using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests.Base; using Xunit; namespace Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests { - public class IdentityServerTests : IClassFixture> + public class IdentityServerTests : BaseClassFixture { - private readonly HttpClient _client; - - public IdentityServerTests(WebApplicationFactory factory) + public IdentityServerTests(WebApplicationFactory factory) : base(factory) { - _client = factory.SetupClient(); } [Fact] public async Task CanShowDiscoveryEndpoint() { var disco = await _client.GetDiscoveryDocumentAsync("http://localhost"); - + disco.Should().NotBeNull(); disco.IsError.Should().Be(false); diff --git a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/ManageControllerTests.cs b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/ManageControllerTests.cs index ba95638c6..7bde548cc 100644 --- a/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/ManageControllerTests.cs +++ b/tests/Skoruba.IdentityServer4.STS.Identity.IntegrationTests/Tests/ManageControllerTests.cs @@ -1,21 +1,18 @@ using System.Net; -using System.Net.Http; using System.Threading.Tasks; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Common; using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Mocks; +using Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests.Base; using Xunit; namespace Skoruba.IdentityServer4.STS.Identity.IntegrationTests.Tests { - public class ManageControllerTests : IClassFixture> + public class ManageControllerTests : BaseClassFixture { - private readonly HttpClient _client; - - public ManageControllerTests(WebApplicationFactory factory) + public ManageControllerTests(WebApplicationFactory factory) : base(factory) { - _client = factory.SetupClient(); } [Fact]