public void TestUpdatingProjectId() { CredentialStoreMock.Raise( cs => cs.CurrentProjectIdChanged += null, CredentialsStore.Default, null); Assert.IsTrue(_objectUnderTest.IsAccountChanged); }
public void TestDisposeDisablesResetProjectId() { _objectUnderTest.Dispose(); CredentialStoreMock.Raise(cs => cs.Reset += null, CredentialsStore.Default, null); Assert.IsFalse(_objectUnderTest.IsAccountChanged); }
public void TestIsGridVisibleProperty() { CredentialStoreMock.SetupGet(cs => cs.CurrentProjectId).Returns("new-project-id"); CredentialStoreMock.Raise(cs => cs.CurrentProjectIdChanged += null, CredentialsStore.Default, null); Assert.IsTrue(_objectUnderTest.IsGridVisible); CollectionAssert.Contains(_propertiesChanged, nameof(_objectUnderTest.IsGridVisible)); }
public void TestCurrentAccountChanged_UpdatesGPlusDataSource() { IGPlusDataSource origianlGPlusDataSource = _objectUnderTest.GPlusDataSource; CredentialStoreMock.Raise(cs => cs.CurrentAccountChanged += null, EventArgs.Empty); Assert.AreNotEqual(origianlGPlusDataSource, _objectUnderTest.GPlusDataSource); }
public void TestProjectIdReset() { _objectUnderTest.Frame = _frameMock.Object; ILogsViewerViewModel oldViewModel = _objectUnderTest.ViewModel; CredentialStoreMock.Raise(cs => cs.Reset += null, CredentialsStore.Default, null); Assert.AreNotEqual(oldViewModel, _objectUnderTest.ViewModel); }
public void TestRefreshInstancesCommand_EnabledByValidProject() { _getInstanceListTaskSource.SetResult(s_allInstances); _objectUnderTest.OnVisible(); CredentialStoreMock.SetupGet(cs => cs.CurrentProjectId).Returns("project-id"); CredentialStoreMock.Raise(cs => cs.CurrentProjectIdChanged += null, CredentialsStore.Default, null); Assert.IsTrue(_objectUnderTest.RefreshInstancesCommand.CanExecuteCommand); }
public void TestCloseDisablesProjectIdReset() { _objectUnderTest.Frame = _frameMock.Object; ILogsViewerViewModel oldViewModel = _objectUnderTest.ViewModel; ((IVsWindowPane)_objectUnderTest).ClosePane(); CredentialStoreMock.Raise(cs => cs.Reset += null, CredentialsStore.Default, null); Assert.AreEqual(oldViewModel, _objectUnderTest.ViewModel); }
public void TestCurrentAccountChanged_InvokesDataSourcesUpdated() { var eventHandlerMock = new Mock <Action <object, EventArgs> >(); _objectUnderTest.DataSourcesUpdated += new EventHandler(eventHandlerMock.Object); CredentialStoreMock.Raise(cs => cs.CurrentAccountChanged += null, EventArgs.Empty); eventHandlerMock.Verify(h => h(_objectUnderTest, EventArgs.Empty)); }
public void TestGPlusDataSource_ResetByAccountChange() { CredentialStoreMock.SetupGet(cs => cs.CurrentGoogleCredential) .Returns(() => null); IGPlusDataSource emptyCredentailsSource = _objectUnderTest.GPlusDataSource; CredentialStoreMock.SetupGet(cs => cs.CurrentGoogleCredential) .Returns(_userAccount.GetGoogleCredential()); CredentialStoreMock.Raise(cs => cs.CurrentAccountChanged += null, EventArgs.Empty); IGPlusDataSource updatedCredentialsSource = _objectUnderTest.GPlusDataSource; Assert.IsNull(emptyCredentailsSource); Assert.That.DataSource(updatedCredentialsSource).IsBuiltFrom(_userAccount); }
public void TestResetProjectId() { CredentialStoreMock.Raise(cs => cs.Reset += null, CredentialsStore.Default, null); Assert.IsTrue(_objectUnderTest.IsAccountChanged); }