Example #1
0
        public void GetBatchNodeFileByComputeNodeContentParametersTest()
        {
            // Setup cmdlet without required parameters
            BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();

            cmdlet.BatchContext    = context;
            cmdlet.PoolId          = null;
            cmdlet.ComputeNodeId   = null;
            cmdlet.Path            = null;
            cmdlet.InputObject     = null;
            cmdlet.DestinationPath = null;

            string filePath = "startup\\stdout.txt";

            // Don't go to the service on a Get NodeFile call or Get NodeFile Properties call
            RequestInterceptor interceptor = BatchTestHelpers.CreateFakeGetFileAndPropertiesFromComputeNodeResponseInterceptor(cmdlet.Path);

            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 <ArgumentException>(() => cmdlet.ExecuteCmdlet());

                // Fill required compute node details
                cmdlet.PoolId        = "pool";
                cmdlet.ComputeNodeId = "computeNode1";
                cmdlet.Path          = filePath;

                // Verify no exceptions occur
                cmdlet.ExecuteCmdlet();
            }
        }