public void RegisterCommand_validUserEdit_returns_UserEdit() { //Arrange var moq = new Mock <IAPIinterface>(); var register = new EditViewModel(moq.Object); //Act register.Init(user); //Assert Assert.IsType <UserEdit>(register.EditedUser); }
public void GetErrors_ValidatesUser_returns_true(string firstname, string lastname, DateTime dateOfBirth, string nationality, string mail, string property) { //Arrange var moq = new Mock <IAPIinterface>(); var editViewModel = new EditViewModel(moq.Object); editViewModel.Init(user); editViewModel.EditedUser = new UserEdit() { FirstName = firstname, LastName = lastname, Nationality = nationality, Email = mail }; editViewModel.EditedUser.BirthDate = dateOfBirth; bool expected = true; //Act var errors = editViewModel.EditedUser.GetErrors(property).ToList <string>(); var actual = errors.Any(); //Assert Assert.Equal(expected, actual); }
public async void EditUser_validUser_returns_NoErrorMessage() { //Arrange var moq = new Mock <IAPIinterface>(); var editViewModel = new EditViewModel(moq.Object); editViewModel.Init(user); editViewModel.test = true; //Act user.FirstName = "test"; user.LastName = "test"; user.Email = "*****@*****.**"; var status = await GetUser(user); if (!status.IsSuccessStatusCode) { editViewModel.EditedUser.ErrorMessage = await status.Content.ReadAsStringAsync(); } //Assert Assert.Null(editViewModel.EditedUser.ErrorMessage); }