Beispiel #1
0
        public void CanCreateUpdateDeleteAutomationModules()
        {
            using (var context = MockContext.Start(GetType().FullName))
            {
                using (var testFixture = new AutomationTestBase(context))
                {
                    var moduleName = "HelloAndSum";
                    // Content links don't have to be valid for playback. However, these are the actual module download locations used for recording.
                    var contentLink1 = "https://bhbrahmaprodtestingseau.blob.core.windows.net/module1/HelloAndSum.zip";
                    var contentLink2 = "https://bhbrahmaprodtestingseau.blob.core.windows.net/module2/HelloAndSum.zip";

                    testFixture.DeleteModule(moduleName, true);

                    var module = testFixture.CreateAutomationModule(moduleName, contentLink1);

                    Assert.NotNull(module);
                    Assert.Equal(ModuleProvisioningState.Creating, module.ProvisioningState);
                    module = EnsureModuleReachesSuccessProvisioningState(moduleName, testFixture);
                    Assert.Equal(moduleName, module.Name);
                    Assert.Equal("1.0", module.Version);

                    // Update the module
                    module = testFixture.CreateAutomationModule(moduleName, contentLink2);
                    Assert.NotNull(module);
                    Assert.Equal(ModuleProvisioningState.Creating, module.ProvisioningState);
                    module = EnsureModuleReachesSuccessProvisioningState(moduleName, testFixture);
                    Assert.Equal(moduleName, module.Name);
                    Assert.Equal("2.0", module.Version);

                    // Delete the module
                    bool deleteCompleted = false;
                    testFixture.DeleteModule(moduleName);
                    try
                    {
                        testFixture.GetAutomationModule(moduleName);
                    }
                    catch (ErrorResponseException)
                    {
                        // Exception expected
                        deleteCompleted = true;
                    }
                    Assert.True(deleteCompleted);
                }
            }
        }