public void SubmitScriptAction() { var submitCmdlet = new SubmitAzureHDInsightScriptActionCommand { CommandRuntime = commandRuntimeMock.Object, HDInsightManagementClient = hdinsightManagementMock.Object, ClusterName = ClusterName, ResourceGroupName = ResourceGroupName, Name = scriptActionDetail.Name, Uri = new Uri(scriptActionDetail.Uri), Parameters = scriptActionDetail.Parameters, NodeTypes = scriptActionDetail.Roles.Select(r => (RuntimeScriptActionClusterNodeType)Enum.Parse(typeof(RuntimeScriptActionClusterNodeType), r, true)).ToArray(), PersistOnSuccess = true }; hdinsightManagementMock.Setup(c => c.ExecuteScriptActions(ResourceGroupName, ClusterName, It.Is <ExecuteScriptActionParameters>(param => CompareScriptActions(param.ScriptActions.First(), scriptActionDetail) && param.PersistOnSuccess == true))) .Verifiable(); submitCmdlet.ExecuteCmdlet(); commandRuntimeMock.VerifyAll(); commandRuntimeMock.Verify(f => f.WriteObject( It.Is <AzureHDInsightRuntimeScriptActionOperationResource>( scriptOperationResource => CompareScriptActions(scriptOperationResource, new AzureHDInsightRuntimeScriptAction(scriptActionDetail))))); hdinsightManagementMock.VerifyAll(); hdinsightManagementMock.Verify(c => c.ExecuteScriptActions(ResourceGroupName, ClusterName, It.IsAny <ExecuteScriptActionParameters>()), Times.Once); }
public void SubmitScriptActionOnEdgeNode() { var submitCmdlet = new SubmitAzureHDInsightScriptActionCommand { CommandRuntime = commandRuntimeMock.Object, HDInsightManagementClient = hdinsightManagementMock.Object, ClusterName = ClusterName, ResourceGroupName = ResourceGroupName, Name = scriptActionDetailWithApplicationName.Name, Uri = scriptActionDetailWithApplicationName.Uri, Parameters = scriptActionDetailWithApplicationName.Parameters, ApplicationName = scriptActionDetailWithApplicationName.ApplicationName, NodeTypes = scriptActionDetailWithApplicationName.Roles.Select(r => (RuntimeScriptActionClusterNodeType)Enum.Parse(typeof(RuntimeScriptActionClusterNodeType), r, true)).ToArray(), PersistOnSuccess = false }; hdinsightManagementMock.Setup(c => c.ExecuteScriptActions(ResourceGroupName, ClusterName, It.Is <ExecuteScriptActionParameters>(param => CompareScriptActions(param.ScriptActions.First(), scriptActionDetailWithApplicationName) && param.PersistOnSuccess == false))) .Returns(new OperationResource { ErrorInfo = null, StatusCode = HttpStatusCode.OK, State = AsyncOperationState.Succeeded }) .Verifiable(); submitCmdlet.ExecuteCmdlet(); commandRuntimeMock.VerifyAll(); commandRuntimeMock.Verify(f => f.WriteObject( It.Is <AzureHDInsightRuntimeScriptActionOperationResource>( scriptOperationResource => CompareScriptActions(scriptOperationResource, new AzureHDInsightRuntimeScriptAction(scriptActionDetailWithApplicationName)) && scriptOperationResource.OperationState == AsyncOperationState.Succeeded.ToString()))); hdinsightManagementMock.VerifyAll(); hdinsightManagementMock.Verify(c => c.ExecuteScriptActions(ResourceGroupName, ClusterName, It.IsAny <ExecuteScriptActionParameters>()), Times.Once); }
public void SubmitScriptAction() { var submitCmdlet = new SubmitAzureHDInsightScriptActionCommand { CommandRuntime = commandRuntimeMock.Object, HDInsightManagementClient = hdinsightManagementMock.Object, ClusterName = ClusterName, ResourceGroupName = ResourceGroupName, Name = scriptActionDetail.Name, Uri = scriptActionDetail.Uri, Parameters = scriptActionDetail.Parameters, NodeTypes = scriptActionDetail.Roles.Select(r => (ClusterNodeType)Enum.Parse(typeof(ClusterNodeType), r, true)).ToArray(), PersistOnSuccess = true }; hdinsightManagementMock.Setup(c => c.ExecuteScriptActions(ResourceGroupName, ClusterName, It.Is<ExecuteScriptActionParameters>(param => CompareScriptActions(param.ScriptActions.First(), scriptActionDetail) && param.PersistOnSuccess == true))) .Returns(new OperationResource { ErrorInfo = null, StatusCode = HttpStatusCode.OK, State = AsyncOperationState.Succeeded }) .Verifiable(); submitCmdlet.ExecuteCmdlet(); commandRuntimeMock.VerifyAll(); commandRuntimeMock.Verify(f => f.WriteObject( It.Is<AzureHDInsightRuntimeScriptActionOperationResource>( scriptOperationResource => CompareScriptActions(scriptOperationResource, new AzureHDInsightRuntimeScriptAction(scriptActionDetail)) && scriptOperationResource.OperationState == AsyncOperationState.Succeeded.ToString()))); hdinsightManagementMock.VerifyAll(); hdinsightManagementMock.Verify(c => c.ExecuteScriptActions(ResourceGroupName, ClusterName, It.IsAny<ExecuteScriptActionParameters>()), Times.Once); }