public void DisableAutoScaleParametersTest() { 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 an Disable AutoScale call RequestInterceptor interceptor = new RequestInterceptor((baseRequest) => { BatchRequest <CloudPoolDisableAutoScaleParameters, CloudPoolDisableAutoScaleResponse> request = (BatchRequest <CloudPoolDisableAutoScaleParameters, CloudPoolDisableAutoScaleResponse>)baseRequest; request.ServiceRequestFunc = (cancellationToken) => { CloudPoolDisableAutoScaleResponse response = new CloudPoolDisableAutoScaleResponse(); Task <CloudPoolDisableAutoScaleResponse> task = Task.FromResult(response); return(task); }; }); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; // Verify no exceptions when required parameter is set cmdlet.ExecuteCmdlet(); }
public void DisableAutoScaleParametersTest() { 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 an Disable AutoScale call RequestInterceptor interceptor = BatchTestHelpers.CreateNoOpInterceptor <CloudPoolDisableAutoScaleParameters, CloudPoolDisableAutoScaleResponse>(); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; // Verify no exceptions when required parameter is set cmdlet.ExecuteCmdlet(); }