public void GetBatchRemoteDesktopProtocolFileParametersTest() { // Setup cmdlet without required parameters BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; cmdlet.PoolId = null; cmdlet.ComputeNodeId = null; cmdlet.ComputeNode = null; cmdlet.DestinationPath = null; // Don't go to the service on a Get ComputeNode Remote Desktop call RequestInterceptor interceptor = new RequestInterceptor((baseRequest) => { BatchRequest <ComputeNodeGetRemoteDesktopParameters, ComputeNodeGetRemoteDesktopResponse> request = (BatchRequest <ComputeNodeGetRemoteDesktopParameters, ComputeNodeGetRemoteDesktopResponse>)baseRequest; request.ServiceRequestFunc = (cancellationToken) => { ComputeNodeGetRemoteDesktopResponse response = new ComputeNodeGetRemoteDesktopResponse(); Task <ComputeNodeGetRemoteDesktopResponse> task = Task.FromResult(response); return(task); }; }); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; using (MemoryStream memStream = new MemoryStream()) { // Don't hit the file system during unit tests cmdlet.DestinationStream = memStream; Assert.Throws <ArgumentNullException>(() => cmdlet.ExecuteCmdlet()); // Fill required compute node details cmdlet.PoolId = "pool"; cmdlet.ComputeNodeId = "computeNode1"; // Verify no exceptions occur cmdlet.ExecuteCmdlet(); } }
public void GetBatchRemoteDesktopProtocolFileParametersTest() { // Setup cmdlet without required parameters BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; cmdlet.PoolId = null; cmdlet.ComputeNodeId = null; cmdlet.ComputeNode = null; cmdlet.DestinationPath = null; // Don't go to the service on a Get ComputeNode Remote Desktop call RequestInterceptor interceptor = new RequestInterceptor((baseRequest) => { BatchRequest<ComputeNodeGetRemoteDesktopParameters, ComputeNodeGetRemoteDesktopResponse> request = (BatchRequest<ComputeNodeGetRemoteDesktopParameters, ComputeNodeGetRemoteDesktopResponse>)baseRequest; request.ServiceRequestFunc = (cancellationToken) => { ComputeNodeGetRemoteDesktopResponse response = new ComputeNodeGetRemoteDesktopResponse(); Task<ComputeNodeGetRemoteDesktopResponse> task = Task.FromResult(response); return task; }; }); cmdlet.AdditionalBehaviors = new List<BatchClientBehavior>() { interceptor }; using (MemoryStream memStream = new MemoryStream()) { // Don't hit the file system during unit tests cmdlet.DestinationStream = memStream; Assert.Throws<ArgumentNullException>(() => cmdlet.ExecuteCmdlet()); // Fill required compute node details cmdlet.PoolId = "pool"; cmdlet.ComputeNodeId = "computeNode1"; // Verify no exceptions occur cmdlet.ExecuteCmdlet(); } }