public void ListUsers_CoupleOfExistingUsers_FiltersUser() { var user1 = new User { AccessType = AccountAccessType.Full, Email = "*****@*****.**", Name = "SomeUser" }; var userModel1 = _mapper.Map <User, UserModel>(user1); var user2 = new User { AccessType = AccountAccessType.Read, Email = "*****@*****.**", Name = "SomeUser2" }; var userModel2 = _mapper.Map <User, UserModel>(user2); using (var dbContext = new ExpenseDbContext(Effort.DbConnectionFactory.CreatePersistent(TestInstaller.ExpenseManagerTestDbConnection))) { dbContext.Users.Add(userModel1); dbContext.Users.Add(userModel2); dbContext.SaveChanges(); } // Act var obtainedUsers = _accountFacade.ListUsers(null, AccountAccessType.Read, null, null); // Assert Assert.That(obtainedUsers.Count == 1 && obtainedUsers.First().AccessType == AccountAccessType.Read, "ListUsers failed - actual result does not match the expected one."); }
private List <IndexViewModel> GetAllUsersWithAccess(Account account) { var users = _accountFacade.ListUsers(account.Id, null, null, null); return(Mapper.Map <List <IndexViewModel> >(users)); }