public void StartPoolResizeParametersTest() { BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; cmdlet.Id = null; Assert.Throws <ArgumentNullException>(() => cmdlet.ExecuteCmdlet()); cmdlet.Id = "testPool"; // Don't go to the service on a Resize CloudPool call RequestInterceptor interceptor = new RequestInterceptor((baseRequest) => { BatchRequest <CloudPoolResizeParameters, CloudPoolResizeResponse> request = (BatchRequest <CloudPoolResizeParameters, CloudPoolResizeResponse>)baseRequest; request.ServiceRequestFunc = (cancellationToken) => { CloudPoolResizeResponse response = new CloudPoolResizeResponse(); Task <CloudPoolResizeResponse> task = Task.FromResult(response); return(task); }; }); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; // Verify no exceptions when required parameter is set cmdlet.ExecuteCmdlet(); }
public void StartPoolResizeParametersTest() { BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; cmdlet.Id = null; Assert.Throws<ArgumentNullException>(() => cmdlet.ExecuteCmdlet()); cmdlet.Id = "testPool"; // Don't go to the service on a Resize CloudPool call RequestInterceptor interceptor = new RequestInterceptor((baseRequest) => { BatchRequest<CloudPoolResizeParameters, CloudPoolResizeResponse> request = (BatchRequest<CloudPoolResizeParameters, CloudPoolResizeResponse>)baseRequest; request.ServiceRequestFunc = (cancellationToken) => { CloudPoolResizeResponse response = new CloudPoolResizeResponse(); Task<CloudPoolResizeResponse> task = Task.FromResult(response); return task; }; }); cmdlet.AdditionalBehaviors = new List<BatchClientBehavior>() { interceptor }; // Verify no exceptions when required parameter is set cmdlet.ExecuteCmdlet(); }