Exemple #1
0
        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;

            AzureOperationResponse <Stream, ComputeNodeGetRemoteDesktopHeaders> response = BatchTestHelpers.CreateGetRemoteDesktOperationResponse();

            // Don't go to the service on a Get ComputeNode Remote Desktop call
            RequestInterceptor interceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor <
                ComputeNodeGetRemoteDesktopOptions,
                AzureOperationResponse <Stream, ComputeNodeGetRemoteDesktopHeaders> >(response);

            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();
            }
        }