Exemplo n.º 1
0
        public async Task GetExistingDeployedApplications_ListDeploymentsCall()
        {
            var stack = new Stack {
                Tags = new List <Tag>()
                {
                    new Tag {
                        Key   = Constants.CloudFormationIdentifier.STACK_TAG,
                        Value = "AspNetAppEcsFargate"
                    }
                },
                Description = Constants.CloudFormationIdentifier.STACK_DESCRIPTION_PREFIX,
                StackStatus = StackStatus.CREATE_COMPLETE,
                StackName   = "Stack1"
            };

            _mockAWSResourceQueryer
            .Setup(x => x.GetCloudFormationStacks())
            .Returns(Task.FromResult(new List <Stack>()
            {
                stack
            }));

            var deployedApplicationQueryer = new DeployedApplicationQueryer(
                _mockAWSResourceQueryer.Object,
                _mockLocalUserSettingsEngine.Object,
                _mockOrchestratorInteractiveService.Object);

            var result = await deployedApplicationQueryer.GetExistingDeployedApplications();

            Assert.Single(result);

            var expectedStack = result.First();

            Assert.Equal("Stack1", expectedStack.StackName);
        }
Exemplo n.º 2
0
        public async Task GetExistingDeployedApplications_InvalidConfigurations(string recipeId, string stackDecription, string deploymentStatus)
        {
            var tags = new List <Tag>();

            if (!string.IsNullOrEmpty(recipeId))
            {
                tags.Add(new Tag
                {
                    Key   = Constants.CloudFormationIdentifier.STACK_TAG,
                    Value = "AspNetAppEcsFargate"
                });
            }

            var stack = new Stack
            {
                Tags        = tags,
                Description = stackDecription,
                StackStatus = deploymentStatus,
                StackName   = "Stack1"
            };

            _mockAWSResourceQueryer
            .Setup(x => x.GetCloudFormationStacks())
            .Returns(Task.FromResult(new List <Stack>()
            {
                stack
            }));

            var deployedApplicationQueryer = new DeployedApplicationQueryer(
                _mockAWSResourceQueryer.Object,
                _mockLocalUserSettingsEngine.Object,
                _mockOrchestratorInteractiveService.Object);

            var result = await deployedApplicationQueryer.GetExistingDeployedApplications();

            Assert.Empty(result);
        }