예제 #1
0
 public void Should_be_able_to_compare_UserViewModels_by_userName()
 {
     Given(ViewModel_is_created);
     When("to ViewModels are compared");
     Then("ViewModels should only be equal if userNames are equal", () =>
     {
         var otherUserViewModel = new UserViewModel {Username = "******"};
         viewModel.Equals(otherUserViewModel).ShouldBeTrue();
         otherUserViewModel.Username = "******";
         viewModel.Equals(otherUserViewModel).ShouldBeFalse();
         viewModel.Equals(null).ShouldBeFalse();
     });
 }
예제 #2
0
 public void Assure_the_length_of_the_teamMember_collection_is_one_less_when_one_entry_is_removed()
 {
     Given(the_viewmodel_has_been_created)
         .And("the collection of teamMembers is set",
              () => { viewModel.TeamMembers = new ObservableCollection<UserViewModel>(); })
         .And("the collection of teamMembers has one user in it",
              () => { AddValidUserToTeamMembers("Haldis"); }
         );
     When("the user is deleted from teamMembers", () =>
         {
             var userToRemove = new UserViewModel();
             userToRemove.Username = "******";
             viewModel.TeamMembers.Remove(userToRemove);
         });
     Then("the length of the teamMembers collection should be 0",
          () => { viewModel.TeamMembers.Count.ShouldBe(0); });
 }
예제 #3
0
 public static UserViewModel CreateUserViewModelFromUserDomainModel(User user)
 {
     var model = new UserViewModel
     {
         Username = user.Username,
         Firstname = user.Firstname,
         Middlename = user.Middlename,
         Surname = user.Surname,
         Email = user.Email,
         ImageUrl = user.ImageUrl
     };
     return model;
 }
예제 #4
0
        public static User CreateUserDomainModelFromUserViewModel(UserViewModel model)
        {
            var user = new User(model.Username)
            {
                Firstname = model.Firstname,
                Middlename = model.Middlename,
                Surname = model.Surname,
                Email = model.Email,
                ImageUrl = model.ImageUrl
            };

            return user;
        }
예제 #5
0
 protected static UserViewModel CreateValidUserToTeamMembers(string userName)
 {
     var validUser = new UserViewModel
     {
         Username = userName,
         Firstname = "Haldis",
         ImageUrl = "http://haldis.com"
     };
     return validUser;
 }
예제 #6
0
 protected static void AddValidUserToTeamMembers(string userName)
 {
     var newUser = new UserViewModel
     {
         Username = userName,
         Firstname = "Haldis",
         ImageUrl = "http://haldis.com"
     };
     
     viewModel.TeamMembers.Add(newUser);
 }
예제 #7
0
 public void AddTeamMember(UserViewModel teamMember)
 {
     teamMember.DefaultPictureUri = DeploymentPath + DEFAULT_IMAGE;
     SetVisibilitiesToUserViewModel(teamMember);
     TeamMembers.Add(teamMember);
 }
예제 #8
0
 public UserViewModel CreateCopy(UserViewModel userViewModel)
 {
     var userViewModelCopy = new UserViewModel
     {
         Username = userViewModel.Username,
         Firstname = userViewModel.Firstname,
         Middlename = userViewModel.Middlename,
         Surname = userViewModel.Surname,
         Email = userViewModel.Email,
         ImageUrl = userViewModel.ImageUrl,
         DefaultPictureUri = userViewModel.DefaultPictureUri
     };
     SetVisibilitiesToUserViewModel(userViewModelCopy);
     return userViewModelCopy;
 }
예제 #9
0
 private void SetVisibilitiesToUserViewModel(UserViewModel user)
 {
     user.FirstnameIsVisible = FirstnameIsChecked ? Visibility.Visible : Visibility.Collapsed;
     user.MiddlenameIsVisible = MiddlenameIsChecked ? Visibility.Visible : Visibility.Collapsed;
     user.SurnameIsVisible = SurnameIsChecked ? Visibility.Visible : Visibility.Collapsed;
     user.UsernameIsVisible = UsernameIsChecked ? Visibility.Visible : Visibility.Collapsed;
 }