public void GetBatchJobScheduleTest()
        {
            // Setup cmdlet to get a job schedule by id
            BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();

            cmdlet.BatchContext = context;
            cmdlet.Id           = "testJobSchedule";
            cmdlet.Filter       = null;

            // Build a CloudJobSchedule instead of querying the service on a Get CloudJobSchedule call
            CloudJobScheduleGetResponse response    = BatchTestHelpers.CreateCloudJobScheduleGetResponse(cmdlet.Id);
            RequestInterceptor          interceptor = BatchTestHelpers.CreateNoOpInterceptor <CloudJobScheduleGetParameters, CloudJobScheduleGetResponse>(response);

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

            // Setup the cmdlet to write pipeline output to a list that can be examined later
            List <PSCloudJobSchedule> pipeline = new List <PSCloudJobSchedule>();

            commandRuntimeMock.Setup(r => r.WriteObject(It.IsAny <PSCloudJobSchedule>())).Callback <object>(j => pipeline.Add((PSCloudJobSchedule)j));

            cmdlet.ExecuteCmdlet();

            // Verify that the cmdlet wrote the job schedule returned from the OM to the pipeline
            Assert.Equal(1, pipeline.Count);
            Assert.Equal(cmdlet.Id, pipeline[0].Id);
        }
        public void GetBatchJobScheduleODataTest()
        {
            // Setup cmdlet to get a single job schedule
            BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();

            cmdlet.BatchContext = context;
            cmdlet.Id           = "testJobSchedule";
            cmdlet.Select       = "id,state";
            cmdlet.Expand       = "stats";

            string requestSelect = null;
            string requestExpand = null;

            // Fetch the OData clauses off the request. The OData clauses are applied after user provided RequestInterceptors, so a ResponseInterceptor is used.
            CloudJobScheduleGetResponse getResponse         = BatchTestHelpers.CreateCloudJobScheduleGetResponse(cmdlet.Id);
            RequestInterceptor          requestInterceptor  = BatchTestHelpers.CreateFakeServiceResponseInterceptor <CloudJobScheduleGetParameters, CloudJobScheduleGetResponse>(getResponse);
            ResponseInterceptor         responseInterceptor = new ResponseInterceptor((response, request) =>
            {
                requestSelect = request.Parameters.DetailLevel.SelectClause;
                requestExpand = request.Parameters.DetailLevel.ExpandClause;

                return(Task.FromResult(response));
            });

            cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>()
            {
                requestInterceptor, responseInterceptor
            };

            cmdlet.ExecuteCmdlet();

            Assert.Equal(cmdlet.Select, requestSelect);
            Assert.Equal(cmdlet.Expand, requestExpand);
        }