本文整理汇总了C#中Member.AsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# Member.AsQueryable方法的具体用法?C# Member.AsQueryable怎么用?C# Member.AsQueryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member.AsQueryable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_get_if_user_not_in_role
// [TestMethod]
public void Can_get_if_user_not_in_role()
{
var role = "Admin";
var email = "[email protected]";
var members = new Member[] { new Member { Email = email, Roles = new string[] { role } } };
var repo = new Mock<IEntityRepository<Member>>();
repo.SetupGet(x => x.Query).Returns(members.AsQueryable());
var result = new MemberRoleProvider(repo.Object).IsUserInRole(email, "NotRole");
//Assert.IsFalse(result);
}
示例2: Can_get_users_by_role
// [TestMethod]
public void Can_get_users_by_role()
{
var role = "Admin";
var email = "[email protected]";
var members = new Member[] { new Member { Email = email, Roles = new string[] { role } }, new Member() };
var repo = new Mock<IEntityRepository<Member>>();
repo.SetupGet(x => x.Query).Returns(members.AsQueryable());
var result = new MemberRoleProvider(repo.Object).GetUsersInRole(role);
//assert.areequal(1, result.length);
//assert.areequal(email, result[0]);
}