public void UserInRoleExists_returnsTrueIfUserInRoleExists()
 {
     bool validate;
     var user = Builder<User>.CreateNew().Build();
     var role = Builder<Role>.CreateNew().With(x => x.Users = new List<User> { user }).Build();
     _userRepository = Mockery.Stub<IUserRepository>();
     _roleRepository = Mockery.Stub<IRoleRepository>();
     using (Mockery.Record())
     {
         Expect.Call(_roleRepository.GetRoleByRoleName(null)).IgnoreArguments().Return(role);
     }
     using (Mockery.Playback())
     {
         _roleService = new RoleService(_roleRepository, _userRepository);
         validate = _roleService.UserInRoleExists(role.RoleName);
     }
     Assert.AreEqual(true, validate);
 }
 public void UserInRoleExists_returnsFalseIfRoleNotExists()
 {
     bool validate;
     _userRepository = Mockery.Stub<IUserRepository>();
     _roleRepository = Mockery.Stub<IRoleRepository>();
     using (Mockery.Record())
     {
         Expect.Call(_roleRepository.GetRoleByRoleName(null)).IgnoreArguments().Return(null);
     }
     using (Mockery.Playback())
     {
         _roleService = new RoleService(_roleRepository, _userRepository);
         validate = _roleService.UserInRoleExists("UnknownRole");
     }
     Assert.AreEqual(false, validate);
 }