You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.4 KiB
67 lines
2.4 KiB
/*
|
|
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
|
* See https://github.com/openiddict/openiddict-core for more information concerning
|
|
* the license and the contributors participating to this project.
|
|
*/
|
|
|
|
using System;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using OpenIddict.Models;
|
|
using Xunit;
|
|
|
|
namespace OpenIddict.Core.Tests
|
|
{
|
|
public class OpenIddictExtensionsTests
|
|
{
|
|
[Theory]
|
|
[InlineData(typeof(OpenIddictApplicationManager<OpenIddictApplication>))]
|
|
[InlineData(typeof(OpenIddictAuthorizationManager<OpenIddictAuthorization>))]
|
|
[InlineData(typeof(OpenIddictScopeManager<OpenIddictScope>))]
|
|
[InlineData(typeof(OpenIddictTokenManager<OpenIddictToken>))]
|
|
public void AddOpenIddict_KeyTypeDefaultsToString(Type type)
|
|
{
|
|
// Arrange
|
|
var services = new ServiceCollection();
|
|
|
|
// Act
|
|
services.AddOpenIddict();
|
|
|
|
// Assert
|
|
Assert.Contains(services, service => service.ImplementationType == type);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(typeof(OpenIddictApplicationManager<OpenIddictApplication<Guid>>))]
|
|
[InlineData(typeof(OpenIddictAuthorizationManager<OpenIddictAuthorization<Guid>>))]
|
|
[InlineData(typeof(OpenIddictScopeManager<OpenIddictScope<Guid>>))]
|
|
[InlineData(typeof(OpenIddictTokenManager<OpenIddictToken<Guid>>))]
|
|
public void AddOpenIddict_KeyTypeCanBeOverriden(Type type)
|
|
{
|
|
// Arrange
|
|
var services = new ServiceCollection();
|
|
|
|
// Act
|
|
services.AddOpenIddict<Guid>();
|
|
|
|
// Assert
|
|
Assert.Contains(services, service => service.ImplementationType == type);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(typeof(OpenIddictApplicationManager<object>))]
|
|
[InlineData(typeof(OpenIddictAuthorizationManager<object>))]
|
|
[InlineData(typeof(OpenIddictScopeManager<object>))]
|
|
[InlineData(typeof(OpenIddictTokenManager<object>))]
|
|
public void AddOpenIddict_DefaultEntitiesCanBeReplaced(Type type)
|
|
{
|
|
// Arrange
|
|
var services = new ServiceCollection();
|
|
|
|
// Act
|
|
services.AddOpenIddict<object, object, object, object>();
|
|
|
|
// Assert
|
|
Assert.Contains(services, service => service.ServiceType == type);
|
|
}
|
|
}
|
|
}
|
|
|