public void SaveCommandEndsEditsAndSavesSettings() { var vm = CreateVm(); var childViewModel = new TestViewmodel(); vm.HasUnsavedChanges = true;; vm.SaveCommand.Execute(null); _appSettings.Verify(m => m.Save(), Times.Once); _messageBus.Verify(m => m.Publish(It.Is <EditEndMessage>(msg => msg == EditEndMessage.Accepted), It.IsAny <string>())); Assert.IsFalse(vm.HasUnsavedChanges); }
public void SelectProfileEndsEdits() { string profile1 = "profile 1"; string profile2 = "profile 2"; var vm = CreateVm(); var childViewModel = new TestViewmodel(); vm.SelectedViewModel = childViewModel; childViewModel.BeginEdit(); _appSettings.SetupGet(m => m.Profiles).Returns(new List <string> { profile1, profile2 }); vm.SelectedProfileName = profile2; Assert.IsFalse(vm.IsEditing); }
public void SelectProfileCommandExecuted_PublishesEndsEditMessage() { var profile1 = new UserProfile { Name = "profile 1" }; var profile2 = new UserProfile { Name = "profile 2" }; var vm = CreateVm(); var childViewModel = new TestViewmodel(); vm.SelectedViewModel = childViewModel; childViewModel.BeginEdit(); _appSettings.SetupGet(m => m.Profiles).Returns(new List <UserProfile> { profile1, profile2 }); vm.SelectedProfileName = profile2.Name; Assert.False(vm.IsEditing); }