public void TestRefreshEnvironment() { //arrange var environmentViewModelMock = new Mock <IEnvironmentViewModel>(); var serverMock = new Mock <IServer>(); var envId = Guid.NewGuid(); serverMock.SetupGet(it => it.EnvironmentID).Returns(envId); environmentViewModelMock.SetupGet(it => it.Server).Returns(serverMock.Object); environmentViewModelMock.SetupGet(it => it.IsConnected).Returns(true); var child = new Mock <IExplorerItemViewModel>(); child.SetupGet(it => it.AllowResourceCheck).Returns(true); child.SetupGet(it => it.IsVisible).Returns(true); environmentViewModelMock.Setup(a => a.Children).Returns(new ObservableCollection <IExplorerItemViewModel>() { child.Object }); _target.Environments = new ObservableCollection <IEnvironmentViewModel>() { environmentViewModelMock.Object }; _target.SearchText = "someText"; //act _target.RefreshEnvironment(envId); //assert environmentViewModelMock.VerifyGet(it => it.IsConnected); environmentViewModelMock.Verify(it => it.LoadAsync(It.IsAny <bool>(), It.IsAny <bool>())); environmentViewModelMock.Verify(it => it.Filter("someText")); }
public void TestRefreshEnvironment() { //arrange var environmentViewModelMock = new Mock <IEnvironmentViewModel>(); var serverMock = new Mock <IServer>(); var envId = Guid.NewGuid(); serverMock.SetupGet(it => it.EnvironmentID).Returns(envId); environmentViewModelMock.SetupGet(it => it.Server).Returns(serverMock.Object); environmentViewModelMock.SetupGet(it => it.IsConnected).Returns(true); _target.Environments = new ObservableCollection <IEnvironmentViewModel>() { environmentViewModelMock.Object }; _target.SearchText = "someText"; //act _target.RefreshEnvironment(envId); //assert environmentViewModelMock.VerifyGet(it => it.IsConnected); environmentViewModelMock.Verify(it => it.Load(It.IsAny <bool>(), It.IsAny <bool>())); environmentViewModelMock.Verify(it => it.Filter("someText")); }