示例#1
0
        public void GetBatchComputeNodeLoginSettingsParametersTest()
        {
            BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();

            cmdlet.BatchContext  = context;
            cmdlet.PoolId        = "testIaasPool";
            cmdlet.ComputeNodeId = "computeNode01";

            string ipAddress = "104.214.75.220";

            // Don't go to the service on an Get RemoteLoginSettings call
            AzureOperationResponse <ComputeNodeGetRemoteLoginSettingsResult, ComputeNodeGetRemoteLoginSettingsHeaders> response =
                BatchTestHelpers.CreateRemoteLoginSettingsGetResponse(ipAddress);
            RequestInterceptor interceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor <
                ComputeNodeGetRemoteLoginSettingsOptions,
                AzureOperationResponse <ComputeNodeGetRemoteLoginSettingsResult, ComputeNodeGetRemoteLoginSettingsHeaders> >(responseToUse: response);

            cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>()
            {
                interceptor
            };

            // Setup the cmdlet to write pipeline output to a list that can be examined later
            PSRemoteLoginSettings loginSettings = null;

            commandRuntimeMock.Setup(r =>
                                     r.WriteObject(It.IsAny <PSRemoteLoginSettings>()))
            .Callback <object>(p => loginSettings = (PSRemoteLoginSettings)p);

            // Verify no exceptions when required parameter is set
            cmdlet.ExecuteCmdlet();

            Assert.Equal(ipAddress, loginSettings.IPAddress);
        }
示例#2
0
        public override void ExecuteCmdlet()
        {
            ComputeNodeOperationParameters parameters = new ComputeNodeOperationParameters(this.BatchContext, this.PoolId, this.ComputeNodeId, this.ComputeNode, this.AdditionalBehaviors);

            PSRemoteLoginSettings remoteLoginSettings = BatchClient.ListComputeNodeRemoteLoginSettings(parameters);

            WriteObject(remoteLoginSettings);
        }