Browse Source

Send integration test logs to xUnit output

pull/1008/head
Martin Costello 6 years ago
committed by GitHub
parent
commit
a92f48dd1c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .gitignore
  2. 1
      Directory.Packages.props
  3. 12
      test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs
  4. 1
      test/OpenIddict.Server.IntegrationTests/OpenIddict.Server.IntegrationTests.csproj
  5. 17
      test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs
  6. 6
      test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs

4
.gitignore

@ -164,3 +164,7 @@ $RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
# Arcade-related folders
.dotnet/
artifacts/

1
Directory.Packages.props

@ -4,6 +4,7 @@
<PackageVersion Include="AngleSharp" Version="0.14.0" />
<PackageVersion Include="EntityFramework" Version="6.4.0" />
<PackageVersion Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.1.0" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.7.0" />

12
test/OpenIddict.Server.AspNetCore.IntegrationTests/OpenIddictServerAspNetCoreIntegrationTests.cs

@ -18,9 +18,11 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using OpenIddict.Abstractions;
using OpenIddict.Server.FunctionalTests;
using Xunit;
using Xunit.Abstractions;
using static OpenIddict.Abstractions.OpenIddictConstants;
using static OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers;
using static OpenIddict.Server.OpenIddictServerEvents;
@ -29,6 +31,11 @@ namespace OpenIddict.Server.AspNetCore.FunctionalTests
{
public partial class OpenIddictServerAspNetCoreIntegrationTests : OpenIddictServerIntegrationTests
{
public OpenIddictServerAspNetCoreIntegrationTests(ITestOutputHelper outputHelper)
: base(outputHelper)
{
}
[Fact]
public async Task ProcessChallenge_ReturnsParametersFromAuthenticationProperties()
{
@ -431,6 +438,11 @@ namespace OpenIddict.Server.AspNetCore.FunctionalTests
#endif
builder.UseEnvironment("Testing");
builder.ConfigureLogging(builder =>
{
builder.AddXUnit(OutputHelper);
});
builder.ConfigureServices(ConfigureServices);
builder.ConfigureServices(services =>
{

1
test/OpenIddict.Server.IntegrationTests/OpenIddict.Server.IntegrationTests.csproj

@ -16,6 +16,7 @@
<ItemGroup>
<PackageReference Include="AngleSharp" />
<PackageReference Include="MartinCostello.Logging.XUnit" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Moq" />
<PackageReference Include="System.Linq.Async" />

17
test/OpenIddict.Server.IntegrationTests/OpenIddictServerIntegrationTests.cs

@ -12,12 +12,12 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
using OpenIddict.Abstractions;
using OpenIddict.Core;
using Xunit;
using Xunit.Abstractions;
using static OpenIddict.Abstractions.OpenIddictConstants;
using static OpenIddict.Server.OpenIddictServerEvents;
using static OpenIddict.Server.OpenIddictServerHandlers;
@ -26,6 +26,13 @@ namespace OpenIddict.Server.FunctionalTests
{
public abstract partial class OpenIddictServerIntegrationTests
{
protected OpenIddictServerIntegrationTests(ITestOutputHelper outputHelper)
{
OutputHelper = outputHelper;
}
protected ITestOutputHelper OutputHelper { get; }
[Fact]
public async Task ProcessAuthentication_UnknownEndpointCausesAnException()
{
@ -4268,7 +4275,7 @@ namespace OpenIddict.Server.FunctionalTests
var manager = new Mock<OpenIddictApplicationManager<OpenIddictApplication>>(
Mock.Of<IOpenIddictApplicationCache<OpenIddictApplication>>(),
Mock.Of<IOpenIddictApplicationStoreResolver>(),
Mock.Of<ILogger<OpenIddictApplicationManager<OpenIddictApplication>>>(),
OutputHelper.ToLogger<OpenIddictApplicationManager<OpenIddictApplication>>(),
Mock.Of<IOptionsMonitor<OpenIddictCoreOptions>>());
configuration?.Invoke(manager);
@ -4282,7 +4289,7 @@ namespace OpenIddict.Server.FunctionalTests
var manager = new Mock<OpenIddictAuthorizationManager<OpenIddictAuthorization>>(
Mock.Of<IOpenIddictAuthorizationCache<OpenIddictAuthorization>>(),
Mock.Of<IOpenIddictAuthorizationStoreResolver>(),
Mock.Of<ILogger<OpenIddictAuthorizationManager<OpenIddictAuthorization>>>(),
OutputHelper.ToLogger<OpenIddictAuthorizationManager<OpenIddictAuthorization>>(),
Mock.Of<IOptionsMonitor<OpenIddictCoreOptions>>());
configuration?.Invoke(manager);
@ -4296,7 +4303,7 @@ namespace OpenIddict.Server.FunctionalTests
var manager = new Mock<OpenIddictScopeManager<OpenIddictScope>>(
Mock.Of<IOpenIddictScopeCache<OpenIddictScope>>(),
Mock.Of<IOpenIddictScopeStoreResolver>(),
Mock.Of<ILogger<OpenIddictScopeManager<OpenIddictScope>>>(),
OutputHelper.ToLogger<OpenIddictScopeManager<OpenIddictScope>>(),
Mock.Of<IOptionsMonitor<OpenIddictCoreOptions>>());
configuration?.Invoke(manager);
@ -4310,7 +4317,7 @@ namespace OpenIddict.Server.FunctionalTests
var manager = new Mock<OpenIddictTokenManager<OpenIddictToken>>(
Mock.Of<IOpenIddictTokenCache<OpenIddictToken>>(),
Mock.Of<IOpenIddictTokenStoreResolver>(),
Mock.Of<ILogger<OpenIddictTokenManager<OpenIddictToken>>>(),
OutputHelper.ToLogger<OpenIddictTokenManager<OpenIddictToken>>(),
Mock.Of<IOptionsMonitor<OpenIddictCoreOptions>>());
configuration?.Invoke(manager);

6
test/OpenIddict.Server.Owin.IntegrationTests/OpenIddictServerOwinIntegrationTests.cs

@ -19,6 +19,7 @@ using OpenIddict.Abstractions;
using OpenIddict.Server.FunctionalTests;
using Owin;
using Xunit;
using Xunit.Abstractions;
using static OpenIddict.Abstractions.OpenIddictConstants;
using static OpenIddict.Server.OpenIddictServerEvents;
using static OpenIddict.Server.Owin.OpenIddictServerOwinHandlers;
@ -27,6 +28,11 @@ namespace OpenIddict.Server.Owin.FunctionalTests
{
public partial class OpenIddictServerOwinIntegrationTests : OpenIddictServerIntegrationTests
{
public OpenIddictServerOwinIntegrationTests(ITestOutputHelper outputHelper)
: base(outputHelper)
{
}
[Fact]
public async Task ProcessChallenge_ReturnsErrorFromAuthenticationProperties()
{

Loading…
Cancel
Save