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);
                    });
                }
            }
        }
        public void CanCreateUpdateDeleteWebhook()
        {
            using (var undoContext = UndoContext.Current)
            {
                undoContext.Start();

                using (AutomationTestBase _testFixture = new AutomationTestBase())
                {
                    var webhookName    = TestUtilities.GenerateName("webhook");
                    var runbookName    = RunbookDefinition.TestFasterWorkflow.RunbookName;
                    var runbookContent = RunbookDefinition.TestFasterWorkflow.PsScript;

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

                    var uri = _testFixture.GenerateUriForWebhook();

                    Webhook webhook = _testFixture.CreateWebhook(webhookName, runbookName, uri);
                    Assert.NotNull(webhook);

                    webhook = _testFixture.GetWebhook(webhook.Name);
                    Assert.NotNull(webhook);
                    Assert.Equal(runbookName, webhook.Properties.Runbook.Name);

                    webhook.Properties.IsEnabled = false;
                    _testFixture.UpdateWebhook(webhook);
                    var webhooks = _testFixture.GetWebhooks();
                    Assert.Equal(1, webhooks.Count);
                    var updatedWebhook = webhooks[0];
                    Assert.False(updatedWebhook.Properties.IsEnabled);

                    webhooks = _testFixture.GetWebhooks(runbookName);
                    Assert.Equal(1, webhooks.Count);
                    updatedWebhook = webhooks[0];
                    Assert.False(updatedWebhook.Properties.IsEnabled);

                    _testFixture.DeleteWebhook(webhook.Name);
                    _testFixture.DeleteRunbook(runbookName);

                    Assert.Throws <CloudException>(() =>
                    {
                        webhook = _testFixture.GetWebhook(webhook.Name);
                    });
                }
            }
        }
예제 #4
0
        public void CanCreateUpdateDeleteWebhook()
        {
            using (var undoContext = UndoContext.Current)
            {
                undoContext.Start();

                using (AutomationTestBase _testFixture = new AutomationTestBase())
                {
                    var webhookName = TestUtilities.GenerateName("webhook");
                    var runbookName = RunbookDefinition.TestFasterWorkflow.RunbookName;
                    var runbookContent = RunbookDefinition.TestFasterWorkflow.PsScript;

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

                    var uri = _testFixture.GenerateUriForWebhook();

                    Webhook webhook = _testFixture.CreateWebhook(webhookName, runbookName, uri);
                    Assert.NotNull(webhook);

                    webhook = _testFixture.GetWebhook(webhook.Name);
                    Assert.NotNull(webhook);
                    Assert.Equal(runbookName, webhook.Properties.Runbook.Name);

                    webhook.Properties.IsEnabled = false;
                    _testFixture.UpdateWebhook(webhook);
                    var webhooks = _testFixture.GetWebhooks();
                    Assert.Equal(1, webhooks.Count);
                    var updatedWebhook = webhooks[0];
                    Assert.False(updatedWebhook.Properties.IsEnabled);

                    webhooks = _testFixture.GetWebhooks(runbookName);
                    Assert.Equal(1, webhooks.Count);
                    updatedWebhook = webhooks[0];
                    Assert.False(updatedWebhook.Properties.IsEnabled);

                    _testFixture.DeleteWebhook(webhook.Name);
                    _testFixture.DeleteRunbook(runbookName);

                    Assert.Throws<CloudException>(() =>
                    {
                        webhook = _testFixture.GetWebhook(webhook.Name);
                    });
                }
            }
        }