コード例 #1
0
        public void CanCreateUpdateDeleteRunbook()
        {
            using (var undoContext = UndoContext.Current)
            {
                undoContext.Start();
                using (AutomationTestBase _testFixture = new AutomationTestBase())
                {
                    string runbookName    = RunbookDefinition.TestFasterWorkflow.RunbookName;
                    string runbookContent = RunbookDefinition.TestFasterWorkflow.PsScript;

                    _testFixture.CreateRunbook(runbookName, runbookContent);
                    var runbook = _testFixture.GetRunbook(runbookName);
                    Assert.NotNull(runbook);

                    _testFixture.PublishRunbook(runbook.Name);
                    runbook = _testFixture.GetRunbook(runbookName);
                    Assert.Equal("Published", runbook.Properties.State);

                    var description = "description of runbook";
                    runbook.Properties.LogProgress = true;
                    runbook.Properties.Description = description;

                    _testFixture.UpdateRunbook(runbook);
                    var updatedRunbook = _testFixture.GetRunbook(runbookName);
                    Assert.Equal(runbook.Properties.LogProgress, true);
                    Assert.Equal(runbook.Properties.LogVerbose, false);
                    Assert.Equal(runbook.Properties.Description, updatedRunbook.Properties.Description);

                    string runbookContentV2 = RunbookDefinition.TestFasterWorkflow_V2.PsScript;
                    _testFixture.UpdateRunbookContent(runbookName, runbookContentV2);

                    string updatedContent = _testFixture.GetRunbookContent(runbookName);
                    Assert.Equal(runbookContentV2, updatedContent);

                    _testFixture.DeleteRunbook(runbookName);

                    Assert.Throws <CloudException>(() =>
                    {
                        runbook = _testFixture.GetRunbook(runbookName);
                    });
                }
            }
        }
コード例 #2
0
        public void CanCreateUpdateDeleteRunbook()
        {
            using (var undoContext = UndoContext.Current)
            {
                undoContext.Start();
                using (AutomationTestBase _testFixture = new AutomationTestBase())
                {
                    string runbookName = RunbookDefinition.TestFasterWorkflow.RunbookName;
                    string runbookContent = RunbookDefinition.TestFasterWorkflow.PsScript;

                    _testFixture.CreateRunbook(runbookName, runbookContent);
                    var runbook = _testFixture.GetRunbook(runbookName);
                    Assert.NotNull(runbook);

                    _testFixture.PublishRunbook(runbook.Name);
                    runbook = _testFixture.GetRunbook(runbookName);
                    Assert.Equal("Published", runbook.Properties.State);

                    var description = "description of runbook";
                    runbook.Properties.LogProgress = true;
                    runbook.Properties.Description = description;

                    _testFixture.UpdateRunbook(runbook);
                    var updatedRunbook = _testFixture.GetRunbook(runbookName);
                    Assert.Equal(runbook.Properties.LogProgress, true);
                    Assert.Equal(runbook.Properties.LogVerbose, false);
                    Assert.Equal(runbook.Properties.Description, updatedRunbook.Properties.Description);

                    string runbookContentV2 = RunbookDefinition.TestFasterWorkflow_V2.PsScript;
                    _testFixture.UpdateRunbookContent(runbookName, runbookContentV2);

                    string updatedContent = _testFixture.GetRunbookContent(runbookName);
                    Assert.Equal(runbookContentV2, updatedContent);

                    _testFixture.DeleteRunbook(runbookName);

                    Assert.Throws<CloudException>(() =>
                    {
                        runbook = _testFixture.GetRunbook(runbookName);
                    });
                }
            }
        }