public void SaveTest() { var personToSave = new Person {Id = Guid.NewGuid(), Name = "Micke"}; var personDataAccessMock = new Mock<IPersonDataAccess>(); personDataAccessMock.Setup(pA => pA.LoadPerson(personToSave.Id)).Returns(personToSave); var viewModel = new RegistratePersonViewModel(personDataAccessMock.Object) { Pers = { Id = personToSave.Id, Name = personToSave.Name } }; viewModel.Save(); var loadedPerson = personDataAccessMock.Object.LoadPerson(personToSave.Id); Assert.AreEqual(personToSave.Id, loadedPerson.Id); Assert.AreEqual(personToSave.Name, loadedPerson.Name); }
private void ValidatePerson(Person source, Person loadedPerson) { Assert.IsNotNull(loadedPerson); Assert.AreEqual(source.Id, loadedPerson.Id); Assert.AreEqual(source.Name, loadedPerson.Name); }
public override sealed void Update() { Pers = new Person(); base.RaisePropertyChanged(() => Pers); //InvokePropertyChanged("Pers"); }