Пример #1
0
        public void TestSignIn_PromptsForNoUser()
        {
            CredentialStoreMock.Setup(cs => cs.CurrentAccount).Returns(() => null);

            _objectUnderTest.SignIn();

            PackageMock.Verify(p => p.UserPromptService.PromptUser(It.IsAny <ManageAccountsWindowContent>()));
        }
        public void TestRefreshCommand_RefreshesResourceManagerDataSource()
        {
            _testObject = new PickProjectIdViewModel(DefaultHelpText, false);

            _testObject.RefreshCommand.Execute(null);

            PackageMock.Verify(p => p.DataSourceFactory.ResourceManagerDataSource.RefreshProjects());
        }
        public async Task TestDispose_NonReentrant()
        {
            _objectUnderTest = await KubectlContext.GetForClusterAsync(DefaultCluster, DefaultZone);

            _objectUnderTest.Dispose();
            _objectUnderTest.Dispose();

            PackageMock.Verify(p => p.GetMefService <IFileSystem>().File.Delete(It.IsAny <string>()), Times.Once);
        }
        public void TestChangeUserCommandNoUser()
        {
            CredentialStoreMock.SetupGet(cs => cs.CurrentAccount).Returns(() => null);
            _testObject = new PickProjectIdViewModel(DefaultHelpText, false);

            _testObject.ChangeUserCommand.Execute(null);

            PackageMock.Verify(p => p.UserPromptService.PromptUser(It.IsAny <ManageAccountsWindowContent>()));
            Assert.IsNull(_testObject.LoadTask);
        }
        public void TestEnsureAnalyticsOptIn_SkipsPromptWhenDialogShown()
        {
            _generalOptions.DialogShown = true;
            _generalOptions.OptIn       = false;

            EventsReporterWrapper.EnsureAnalyticsOptIn();

            PackageMock.Verify(
                p => p.UserPromptService.PromptUser(It.IsAny <AnalyticsOptInWindowContent>()),
                Times.Never);
            Assert.IsTrue(_generalOptions.DialogShown);
            Assert.IsFalse(_generalOptions.OptIn);
        }
        public async Task TestDispose_DeletesConfigPath()
        {
            IDictionary <string, string> environment = new Dictionary <string, string>();

            SetupRunCommandGetEnvironment(commandEnvironment => environment = commandEnvironment);

            _objectUnderTest = await KubectlContext.GetForClusterAsync(DefaultCluster, DefaultZone);

            _objectUnderTest.Dispose();

            string expectedDeletePath = environment[KubectlContext.KubeConfigVariable];

            PackageMock.Verify(p => p.GetMefService <IFileSystem>().File.Delete(expectedDeletePath));
        }
Пример #7
0
        public void TestGoToAccountManagementCommand_PromptsUser()
        {
            _objectUnderTest.OnGotoAccountManagementCommand.Execute(null);

            PackageMock.Verify(p => p.UserPromptService.PromptUser(It.IsAny <ManageAccountsWindowContent>()));
        }
        public void TestPublishCommand_Throws()
        {
            _objectUnderTest.ActionCommand.Execute(null);

            PackageMock.Verify(p => p.UserPromptService.ExceptionPrompt(It.IsAny <NotSupportedException>()));
        }
        public void TestChangeUserCommand_CallsPromptManageAccount()
        {
            _testObject.ChangeUserCommand.Execute(null);

            PackageMock.Verify(p => p.UserPromptService.PromptUser(It.IsAny <ManageAccountsWindowContent>()));
        }