blob: 72540c1eec577f55ef9a44c37dd1d4b9052370d7 [file]
using System;
using Casbin.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using NetCasbin;
using Xunit;
namespace Casbin.AspNetCore.Tests
{
public class ServiceCollectionExtensionTest
{
[Fact]
public void ShouldCheckOptions()
{
var collection = new ServiceCollection();
// Success
collection.AddCasbinAuthorizationCore(options =>
{
options.DefaultEnforcerFactory = m => new Enforcer(m);
});
// Failed
Assert.Throws<ArgumentNullException>(() =>
{
collection.AddCasbinAuthorizationCore(options =>
{
});
});
}
}
}