Ejemplo n.º 1
0
        public void TestUserViewModel()
        {
            UserViewModel userViewModel = new UserViewModel();
            userViewModel.Service = serviceFacade;
            UserListDTO user = new UserListDTO() {Id = 1};
            IList<UserListDTO> users = new List<UserListDTO>() {user};
            Expect.Once.On(serviceFacade).Method("GetAllUsers").Will(Return.Value(users));
            userViewModel.LoadCommand.Command.Execute(null);

            Assert.AreEqual<int>(1, userViewModel.Items.Count);
            Assert.AreEqual(user, userViewModel.SelectedItem);
            Assert.AreEqual(Strings.UserViewModel_DisplayName, userViewModel.DisplayName);
        }
Ejemplo n.º 2
0
 private static UserListDTO UserToListDto(User u)
 {
     UserListDTO user = new UserListDTO()
                            {
                                Id = u.UserId,
                                UserName = u.UserName,
                                Roles = RolesAsString(u.Roles)
                            };
     if (u.Customer != null)
     {
         user.CustomerName = u.Customer.ToString();
     }
     return user;
 }