public void GetBatchJobStatisticsTest()
        {
            BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();

            cmdlet.BatchContext = context;

            DateTime startTime = DateTime.UtcNow;

            AzureOperationResponse <
                ProxyModels.JobStatistics,
                ProxyModels.JobGetAllLifetimeStatisticsHeaders> response =
                BatchTestHelpers.CreateJobStatisticsResponse(startTime);

            RequestInterceptor interceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor <
                ProxyModels.JobGetAllLifetimeStatisticsOptions,
                AzureOperationResponse <ProxyModels.JobStatistics, ProxyModels.JobGetAllLifetimeStatisticsHeaders> >(responseToUse: response);

            cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>()
            {
                interceptor
            };

            // Setup the cmdlet to write pipeline output to a variable that can be examined later
            PSJobStatistics statistics = null;

            commandRuntimeMock.Setup(r => r.WriteObject(It.IsAny <PSJobStatistics>())).Callback <object>(c => statistics = (PSJobStatistics)c);

            cmdlet.ExecuteCmdlet();

            Assert.Equal(startTime, statistics.StartTime);
        }
Esempio n. 2
0
        public override void ExecuteCmdlet()
        {
            PSJobStatistics jobStatistics = BatchClient.GetAllJobsLifetimeStatistics(this.BatchContext, this.AdditionalBehaviors);

            WriteObject(jobStatistics);
        }