public void TestInitialize() { _selectedId = Guid.NewGuid(); _filterByType = true; _explorerItemViewModelMock = new Mock <IExplorerItemViewModel>(); _explorerItemViewModelMock.SetupGet(it => it.ResourceName).Returns("someResName"); _explorerItemViewModelMock.SetupGet(it => it.ResourceType).Returns("Folder"); _environmentViewModelMock = new Mock <IEnvironmentViewModel>(); _environmentViewModelMock.Setup(it => it.Filter(It.IsAny <Func <IExplorerItemViewModel, bool> >())) .Callback <Func <IExplorerItemViewModel, bool> >(arg => arg(_explorerItemViewModelMock.Object)); _target = new SingleEnvironmentExplorerViewModel(_environmentViewModelMock.Object, _selectedId, _filterByType); }
public void TestRefreshCommandFilterByTypeFalse() { //arrange _target = new SingleEnvironmentExplorerViewModel(_environmentViewModelMock.Object, _selectedId, false); _environmentViewModelMock.SetupGet(it => it.IsConnected).Returns(true); _target.SearchText = _explorerItemViewModelMock.Object.ResourceName; //act _target.RefreshCommand.Execute(null); //assert _environmentViewModelMock.Verify(it => it.LoadDialog(_selectedId)); _environmentViewModelMock.Verify(it => it.Filter(It.IsAny <Func <IExplorerItemViewModel, bool> >())); }
public void SelectResource(Guid id) { SingleEnvironmentExplorerViewModel.SelectItem(id); }