public void RemoveAzureServiceProcessTest()
        {
            SimpleServiceManagement channel = new SimpleServiceManagement();
            bool serviceDeleted             = false;
            bool deploymentDeleted          = false;

            channel.GetDeploymentBySlotThunk = ar =>
            {
                if (deploymentDeleted)
                {
                    throw new EndpointNotFoundException();
                }
                return(new Deployment(serviceName, ArgumentConstants.Slots[Slot.Production], DeploymentStatus.Suspended));
            };
            channel.DeleteHostedServiceThunk    = ar => serviceDeleted = true;
            channel.DeleteDeploymentBySlotThunk = ar =>
            {
                deploymentDeleted = true;
            };

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                files.CreateAzureSdkDirectoryAndImportPublishSettings();
                AzureService service = new AzureService(files.RootPath, serviceName, null);
                var          removeAzureServiceCommand = new RemoveAzureServiceCommand(channel);
                removeAzureServiceCommand.ShareChannel = true;
                removeAzureServiceCommand.RemoveAzureServiceProcess(service.Paths.RootPath, string.Empty, serviceName);
                Assert.IsTrue(deploymentDeleted);
                Assert.IsTrue(serviceDeleted);
            }
        }
Example #2
0
        public void SetupTest()
        {
            clientMock = new Mock <ICloudServiceClient>();
            clientMock.Setup(f => f.RemoveCloudService(serviceName));

            commandRuntimeMock = new Mock <ICommandRuntime>();
            commandRuntimeMock.Setup(f => f.WriteObject(true));
            commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny <string>(), It.IsAny <string>())).Returns(true);

            removeAzureServiceCmdlet = new RemoveAzureServiceCommand()
            {
                CloudServiceClient = clientMock.Object,
                CommandRuntime     = commandRuntimeMock.Object
            };
        }
        public void SetupTest()
        {
            clientMock = new Mock<ICloudServiceClient>();
            clientMock.Setup(f => f.RemoveCloudService(serviceName));

            commandRuntimeMock = new Mock<ICommandRuntime>();
            commandRuntimeMock.Setup(f => f.WriteObject(true));
            commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny<string>(), It.IsAny<string>())).Returns(true);

            removeAzureServiceCmdlet = new RemoveAzureServiceCommand()
            {
                CloudServiceClient = clientMock.Object,
                CommandRuntime = commandRuntimeMock.Object
            };
        }
        public void SetupTest()
        {
            GlobalPathInfo.GlobalSettingsDirectory = Data.AzureSdkAppDir;
            CmdletSubscriptionExtensions.SessionManager = new InMemorySessionManager();
            mockCommandRuntime = new MockCommandRuntime();
            channel = new SimpleServiceManagement();

            removeServiceCmdlet = new RemoveAzureServiceCommand(channel) { ShareChannel = true };
            removeServiceCmdlet.CommandRuntime = mockCommandRuntime;
        }