public void TestUpdatingProjectId()
        {
            CredentialStoreMock.Raise(
                cs => cs.CurrentProjectIdChanged += null, CredentialsStore.Default, null);

            Assert.IsTrue(_objectUnderTest.IsAccountChanged);
        }
コード例 #2
0
        public void TestDisposeDisablesResetProjectId()
        {
            _objectUnderTest.Dispose();
            CredentialStoreMock.Raise(cs => cs.Reset += null, CredentialsStore.Default, null);

            Assert.IsFalse(_objectUnderTest.IsAccountChanged);
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #8
0
        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));
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        public void TestResetProjectId()
        {
            CredentialStoreMock.Raise(cs => cs.Reset += null, CredentialsStore.Default, null);

            Assert.IsTrue(_objectUnderTest.IsAccountChanged);
        }