public void NewBatchPoolParametersTest() { // Setup cmdlet without the required parameters BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; Assert.Throws<ArgumentNullException>(() => cmdlet.ExecuteCmdlet()); cmdlet.Id = "testPool"; cmdlet.VirtualMachineSize = "small"; cmdlet.OSFamily = "4"; // Don't go to the service on an Add CloudPool call RequestInterceptor interceptor = new RequestInterceptor((baseRequest) => { BatchRequest<CloudPoolAddParameters, CloudPoolAddResponse> request = (BatchRequest<CloudPoolAddParameters, CloudPoolAddResponse>)baseRequest; request.ServiceRequestFunc = (cancellationToken) => { CloudPoolAddResponse response = new CloudPoolAddResponse(); Task<CloudPoolAddResponse> task = Task.FromResult(response); return task; }; }); cmdlet.AdditionalBehaviors = new List<BatchClientBehavior>() { interceptor }; // Verify no exceptions when required parameters are set cmdlet.ExecuteCmdlet(); }
public void NewBatchPoolParametersTest() { // Setup cmdlet without the required parameters BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; Assert.Throws <ArgumentNullException>(() => cmdlet.ExecuteCmdlet()); cmdlet.Id = "testPool"; cmdlet.VirtualMachineSize = "small"; cmdlet.OSFamily = "4"; // Don't go to the service on an Add CloudPool call RequestInterceptor interceptor = new RequestInterceptor((baseRequest) => { BatchRequest <CloudPoolAddParameters, CloudPoolAddResponse> request = (BatchRequest <CloudPoolAddParameters, CloudPoolAddResponse>)baseRequest; request.ServiceRequestFunc = (cancellationToken) => { CloudPoolAddResponse response = new CloudPoolAddResponse(); Task <CloudPoolAddResponse> task = Task.FromResult(response); return(task); }; }); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; // Verify no exceptions when required parameters are set cmdlet.ExecuteCmdlet(); }