/// <summary>
/// Creates a test job schedule for use in Scenario tests.
/// </summary>
public static void CreateTestJobSchedule(BatchController controller, BatchAccountContext context, string jobScheduleId, TimeSpan?recurrenceInterval)
{
RequestInterceptor interceptor = CreateHttpRecordingInterceptor();
BatchClientBehavior[] behaviors = new BatchClientBehavior[] { interceptor };
BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);
PSJobSpecification jobSpecification = new PSJobSpecification();
jobSpecification.PoolInformation = new PSPoolInformation();
jobSpecification.PoolInformation.PoolId = SharedPool;
PSSchedule schedule = new PSSchedule();
if (recurrenceInterval != null)
{
schedule = new PSSchedule();
schedule.RecurrenceInterval = recurrenceInterval;
}
NewJobScheduleParameters parameters = new NewJobScheduleParameters(context, jobScheduleId, behaviors)
{
JobSpecification = jobSpecification,
Schedule = schedule
};
client.CreateJobSchedule(parameters);
}