public void ListBatchSupportedImagesParametersTest() { BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; string[] idsOfNodeAgentSkus = new[] { "batch.node.centos 7", "batch.node.debian 8", "batch.node.opensuse 13.2" }; // Don't go to the service on an Get NodeAgentSkus call AzureOperationResponse <IPage <ProxyModels.ImageInformation>, ProxyModels.AccountListSupportedImagesHeaders> response = BatchTestHelpers.CreateSupportedImagesResponse(idsOfNodeAgentSkus); RequestInterceptor interceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor < ProxyModels.AccountListSupportedImagesOptions, AzureOperationResponse <IPage <ProxyModels.ImageInformation>, ProxyModels.AccountListSupportedImagesHeaders> >(responseToUse: response); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; // Setup the cmdlet to write pipeline output to a list that can be examined later var pipeline = new List <PSImageInformation>(); commandRuntimeMock.Setup(r => r.WriteObject(It.IsAny <PSImageInformation>())) .Callback <object>(p => pipeline.Add((PSImageInformation)p)); // Verify no exceptions when required parameter is set cmdlet.ExecuteCmdlet(); Assert.Equal(3, pipeline.Count); int nodeAgentCount = 0; foreach (PSImageInformation imageInfo in pipeline) { Assert.Contains(imageInfo.NodeAgentSkuId, idsOfNodeAgentSkus); nodeAgentCount++; } Assert.Equal(idsOfNodeAgentSkus.Length, nodeAgentCount); }