【发布时间】:2012-05-22 15:19:28
【问题描述】:
我最近一直在写一些关于我的 Fluent Security 配置的测试。虽然我可以编写测试来验证控制器操作方法是否应用了特定策略,例如
expectations.Expect<HomeController>(x=>x.Index()).Has<IgnorePolicy>();
但是,我正在寻找的是,如果我可以编写特定于角色的测试。
例如,如果我只授予管理员角色访问 HomeController 的 Index() 的权限,我想测试类似
expectations.Expect<HomeController>(x=>x.Index()).Has<RequireRolePolicy>().For("Admin");
我没有在网上找到任何示例,也没有在 FLuentSecurity.TestHelper 中找到任何可以帮助我做到这一点的扩展。有什么想法吗?
【问题讨论】:
标签: asp.net-mvc unit-testing authentication authorization fluent-security