public void Test_CheckAccess_SecurityBypassContext() { EntityRef[] entityIds; IDictionary <long, bool> result; UserAccount userAccount; EntityAccessControlChecker entityAccessControlChecker; MockRepository mockRepository; entityIds = new EntityRef[] { 1, 2, 3 }; mockRepository = new MockRepository(MockBehavior.Strict); entityAccessControlChecker = new EntityAccessControlChecker( mockRepository.Create <IUserRoleRepository>().Object, mockRepository.Create <IQueryRepository>().Object, mockRepository.Create <IEntityTypeRepository>().Object ); userAccount = Entity.Create <UserAccount>(); userAccount.Save(); using (new SecurityBypassContext()) { result = entityAccessControlChecker.CheckAccess(entityIds, new[] { Permissions.Read }, userAccount); } Assert.That(result, Has.Count.EqualTo(entityIds.Count())); Assert.That(result, Has.All.Property("Value").True); mockRepository.VerifyAll(); }