public ScriptActionTests()
        {
            base.SetupTestsForManagement();

            scriptActionDetail = new RuntimeScriptActionDetail 
            {
                ApplicationName = "AppName",
                DebugInformation = "DebugInfo",
                EndTime = new DateTime(2016, 1, 1),
                ExecutionSummary =
                    new List<Microsoft.Azure.Management.HDInsight.Models.ScriptActionExecutionSummary> 
                    {
                        new Microsoft.Azure.Management.HDInsight.Models.ScriptActionExecutionSummary 
                        {
                            Status = "Succeeded",
                            InstanceCount = 4
                        }
                    },
                Name = "ScriptName",
                Operation = "PostCreation",
                Parameters = "Parameters",
                Roles = new List<string> { "HeadNode", "WorkerNode" },
                ScriptExecutionId = DateTime.UtcNow.Ticks,
                StartTime = new DateTime(2016, 1, 2),
                Status = "Succeeded",
                Uri = new Uri("http://bing.com")
            };
        }
        public ScriptActionTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            base.SetupTestsForManagement();

            scriptActionDetail = new RuntimeScriptActionDetail
            {
                ApplicationName = "AppName",
                DebugInformation = "DebugInfo",
                EndTime = new DateTime(2016, 1, 1),
                ExecutionSummary =
                    new List<Microsoft.Azure.Management.HDInsight.Models.ScriptActionExecutionSummary>
                    {
                        new Microsoft.Azure.Management.HDInsight.Models.ScriptActionExecutionSummary
                        {
                            Status = "Succeeded",
                            InstanceCount = 4
                        }
                    },
                Name = "ScriptName",
                Operation = "PostCreation",
                Parameters = "Parameters",
                Roles = new List<string> { "HeadNode", "WorkerNode" },
                ScriptExecutionId = DateTime.UtcNow.Ticks,
                StartTime = new DateTime(2016, 1, 2),
                Status = "Succeeded",
                Uri = new Uri("http://bing.com")
            };

            scriptActionDetailWithApplicationName = new RuntimeScriptActionDetail
            {
                ApplicationName = "AppName",
                DebugInformation = "DebugInfo",
                EndTime = new DateTime(2016, 1, 1),
                ExecutionSummary =
                    new List<Microsoft.Azure.Management.HDInsight.Models.ScriptActionExecutionSummary>
                    {
                        new Microsoft.Azure.Management.HDInsight.Models.ScriptActionExecutionSummary
                        {
                            Status = "Succeeded",
                            InstanceCount = 1
                        }
                    },
                Name = "ScriptNameWithApp",
                Operation = "PostCreation",
                Parameters = "Parameters",
                Roles = new List<string> { "EdgeNode" },
                ScriptExecutionId = DateTime.UtcNow.Ticks,
                StartTime = new DateTime(2016, 1, 2),
                Status = "Succeeded",
                Uri = new Uri("http://bing.com")
            };
        }
        public AzureHDInsightRuntimeScriptActionDetail(RuntimeScriptActionDetail runtimeScriptActionDetail)
            : base(runtimeScriptActionDetail)
        {
            ScriptExecutionId = runtimeScriptActionDetail.ScriptExecutionId;
            StartTime = runtimeScriptActionDetail.StartTime;
            EndTime = runtimeScriptActionDetail.EndTime;
            Status = runtimeScriptActionDetail.Status;
            Operation = runtimeScriptActionDetail.Operation;

            if (runtimeScriptActionDetail.ExecutionSummary != null)
            {
                ExecutionSummary = runtimeScriptActionDetail.ExecutionSummary
                    .Select(e => string.Format("{{{0}: {1}}}", e.Status, e.InstanceCount))
                    .ToList();
            }
            DebugInformation = runtimeScriptActionDetail.DebugInformation;
        }
        private void ValidateHistoryDetail(RuntimeScriptActionDetail runtimeScriptActionDetail, bool includeDebugInfo, string scriptName)
        {
            Assert.Equal(2, runtimeScriptActionDetail.Roles.Count);

            Assert.Equal("PostClusterCreateScriptActionRequest", runtimeScriptActionDetail.Operation);

            Assert.Equal("Succeeded", runtimeScriptActionDetail.Status);

            Assert.Equal(scriptName, runtimeScriptActionDetail.Name);

            Assert.Equal(1, runtimeScriptActionDetail.ExecutionSummary.Count);

            Assert.Equal(5, runtimeScriptActionDetail.ExecutionSummary[0].InstanceCount);

            Assert.Equal("COMPLETED", runtimeScriptActionDetail.ExecutionSummary[0].Status);

            Assert.NotNull(runtimeScriptActionDetail.EndTime);

            Assert.NotNull(runtimeScriptActionDetail.StartTime);

            Assert.Null(runtimeScriptActionDetail.ApplicationName);

            if (includeDebugInfo)
            {
                Assert.NotEmpty(runtimeScriptActionDetail.DebugInformation);

                Assert.NotNull(runtimeScriptActionDetail.DebugInformation);
            }
        }