public void AfterDeleteEventHandlerFiresPropertyChangedEvent() { var results = new Mock <IGitStashResults>(); var page = new Mock <ITeamExplorerBase>(); var wrapper = new Mock <IGitStashWrapper>(); results.Setup(r => r.Success).Returns(true); results.Setup(r => r.Message).Returns("test"); IList <IGitStash> gitStashes = new List <IGitStash>(); var gitStash = new Mock <IGitStash>(); gitStash.Setup(s => s.Index).Returns(0); gitStash.Setup(s => s.Message).Returns("test"); gitStashes.Add(gitStash.Object); wrapper.Setup(w => w.Stashes).Returns(gitStashes); wrapper.Setup(w => w.DropStash( It.IsAny <IGitStashDropOptions>(), It.Is <int>(i => i == 0))) .Returns(results.Object); StashesViewModel vm = new StashesViewModel(wrapper.Object, page.Object, T); AutoResetEvent waitHandle = new AutoResetEvent(false); bool eventWasDispatched = false; vm.PropertyChanged += (o, e) => { waitHandle.Set(); eventWasDispatched = true; }; Assert.IsTrue(vm.Stashes.Count() == 1); StashViewModel stashVM = vm.Stashes.ElementAt(0); stashVM.DeleteDropDownCommand.Execute(null); waitHandle.WaitOne(5000); Assert.IsTrue(eventWasDispatched); }
public ImportViewModels( IDialogCoordinator dialogCoordinator, IPersistentData persistentData, StashViewModel stash) { _dialogCoordinator = dialogCoordinator; _persistentData = persistentData; _stash = stash; _httpClient = new HttpClient(); _currentLeagues = new Lazy <CurrentLeaguesViewModel>(() => new CurrentLeaguesViewModel(_httpClient)); _accountCharacters = new Lazy <AccountCharactersViewModel>(() => new AccountCharactersViewModel(_httpClient)); }