public void ICanCallThe_Get_HDInsightJobsCmdlet() { using (IRunspace runspace = this.GetPowerShellRunspace()) { ClusterDetails testCluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster(); IPipelineResult results = runspace.NewPipeline() .AddCommand(CmdletConstants.GetAzureHDInsightJob) .WithParameter(CmdletConstants.Cluster, testCluster.ConnectionUrl) .WithParameter(CmdletConstants.Credential, GetPSCredential(testCluster.HttpUserName, testCluster.HttpPassword)) .Invoke(); IEnumerable <AzureHDInsightJob> jobHistory = results.Results.ToEnumerable <AzureHDInsightJob>(); JobList expectedJobHistory = HDInsightGetJobsCommandTests.GetJobHistory(testCluster.ConnectionUrl); Assert.AreEqual(expectedJobHistory.Jobs.Count, jobHistory.Count(), "Should have {0} jobs.", expectedJobHistory.Jobs.Count); } }
public void ICanCallThe_Get_HDInsightJobsCmdlet_WithDebug() { using (IRunspace runspace = this.GetPowerShellRunspace()) { ClusterDetails testCluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster(); var logWriter = new PowershellLogWriter(); BufferingLogWriterFactory.Instance = logWriter; IPipelineResult results = runspace.NewPipeline() .AddCommand(CmdletConstants.GetAzureHDInsightJob) .WithParameter(CmdletConstants.Cluster, testCluster.ConnectionUrl) .WithParameter(CmdletConstants.Credential, GetPSCredential(testCluster.HttpUserName, testCluster.HttpPassword)) .WithParameter(CmdletConstants.Debug, null) .Invoke(); IEnumerable <AzureHDInsightJob> jobHistory = results.Results.ToEnumerable <AzureHDInsightJob>(); JobList expectedJobHistory = HDInsightGetJobsCommandTests.GetJobHistory(testCluster.ConnectionUrl); Assert.AreEqual(expectedJobHistory.Jobs.Count, jobHistory.Count(), "Should have {0} jobs.", expectedJobHistory.Jobs.Count); string expectedLogMessage = "Listing jobs"; Assert.IsTrue(logWriter.Buffer.Any(message => message.Contains(expectedLogMessage))); BufferingLogWriterFactory.Reset(); } }