public async Task GetDeploymentOutputs_ElasticLoadBalancer()
        {
            var engine = await BuildRecommendationEngine("WebAppWithDockerFile");

            var recommendations = await engine.ComputeRecommendations();

            var recommendation = recommendations.First(r => r.Recipe.Id.Equals("AspNetAppEcsFargate"));

            _stackResource.LogicalResourceId  = "RecipeServiceLoadBalancer68534AEF";
            _stackResource.PhysicalResourceId = "PhysicalResourceId";
            _stackResource.ResourceType       = "AWS::ElasticLoadBalancingV2::LoadBalancer";
            _loadBalancer.DNSName             = "www.website.com";
            _mockAWSResourceQueryer.Setup(x => x.DescribeCloudFormationResources(It.IsAny <string>())).Returns(Task.FromResult(_stackResources));
            _mockAWSResourceQueryer.Setup(x => x.DescribeElasticLoadBalancer(It.IsAny <string>())).Returns(Task.FromResult(_loadBalancer));
            _mockAWSResourceQueryer.Setup(x => x.DescribeElasticLoadBalancerListeners(It.IsAny <string>())).Returns(Task.FromResult(new List <Amazon.ElasticLoadBalancingV2.Model.Listener>()));
            var disaplayedResourcesHandler = new DisplayedResourcesHandler(_mockAWSResourceQueryer.Object, _displayedResourcesFactory);

            var outputs = await disaplayedResourcesHandler.GetDeploymentOutputs(_cloudApplication, recommendation);

            Assert.Single(outputs);
            var resource = outputs.First();

            Assert.Equal("PhysicalResourceId", resource.Id);
            Assert.Equal("AWS::ElasticLoadBalancingV2::LoadBalancer", resource.Type);
            Assert.Single(resource.Data);
            Assert.True(resource.Data.ContainsKey("Endpoint"));
            Assert.Equal("http://www.website.com/", resource.Data["Endpoint"]);
        }
        public async Task GetDeploymentOutputs_ElasticBeanstalkEnvironment()
        {
            var engine = await BuildRecommendationEngine("WebAppNoDockerFile");

            var recommendations = await engine.ComputeRecommendations();

            var recommendation = recommendations.First(r => r.Recipe.Id.Equals("AspNetAppElasticBeanstalkLinux"));

            _stackResource.LogicalResourceId  = "RecipeBeanstalkEnvironment83CC12DE";
            _stackResource.PhysicalResourceId = "PhysicalResourceId";
            _stackResource.ResourceType       = "AWS::ElasticBeanstalk::Environment";
            _environmentDescription.CNAME     = "www.website.com";
            _mockAWSResourceQueryer.Setup(x => x.DescribeCloudFormationResources(It.IsAny <string>())).Returns(Task.FromResult(_stackResources));
            _mockAWSResourceQueryer.Setup(x => x.DescribeElasticBeanstalkEnvironment(It.IsAny <string>())).Returns(Task.FromResult(_environmentDescription));
            var disaplayedResourcesHandler = new DisplayedResourcesHandler(_mockAWSResourceQueryer.Object, _displayedResourcesFactory);

            var outputs = await disaplayedResourcesHandler.GetDeploymentOutputs(_cloudApplication, recommendation);

            Assert.Single(outputs);
            var resource = outputs.First();

            Assert.Equal("PhysicalResourceId", resource.Id);
            Assert.Equal("AWS::ElasticBeanstalk::Environment", resource.Type);
            Assert.Single(resource.Data);
            Assert.True(resource.Data.ContainsKey("Endpoint"));
            Assert.Equal("http://www.website.com/", resource.Data["Endpoint"]);
        }
        public async Task GetDeploymentOutputs_CloudFrontDistribution()
        {
            var engine = await BuildRecommendationEngine("BlazorWasm31");

            var recommendations = await engine.ComputeRecommendations();

            var recommendation = recommendations.First(r => r.Recipe.Id.Equals("BlazorWasm"));

            _stackResource.LogicalResourceId  = "RecipeCloudFrontDistribution2BE25932";
            _stackResource.PhysicalResourceId = "PhysicalResourceId";
            _stackResource.ResourceType       = "AWS::CloudFront::Distribution";
            _mockAWSResourceQueryer.Setup(x => x.DescribeCloudFormationResources(It.IsAny <string>())).Returns(Task.FromResult(_stackResources));
            _mockAWSResourceQueryer.Setup(x => x.GetCloudFrontDistribution(It.IsAny <string>())).Returns(Task.FromResult(new Amazon.CloudFront.Model.Distribution
            {
                Id         = "PhysicalResourceId",
                DomainName = "id.cloudfront.net"
            }));
            var disaplayedResourcesHandler = new DisplayedResourcesHandler(_mockAWSResourceQueryer.Object, _displayedResourcesFactory);

            var outputs = await disaplayedResourcesHandler.GetDeploymentOutputs(_cloudApplication, recommendation);

            var resource = outputs.First();

            Assert.Equal("PhysicalResourceId", resource.Id);
            Assert.Equal("AWS::CloudFront::Distribution", resource.Type);
            Assert.Single(resource.Data);
            Assert.True(resource.Data.ContainsKey("Endpoint"));
            Assert.Equal("https://id.cloudfront.net/", resource.Data["Endpoint"]);
        }
        public async Task GetDeploymentOutputs_S3BucketWithoutWebSiteConfig()
        {
            var engine = await BuildRecommendationEngine("BlazorWasm31");

            var recommendations = await engine.ComputeRecommendations();

            var recommendation = recommendations.First(r => r.Recipe.Id.Equals("BlazorWasm"));

            _stackResource.LogicalResourceId  = "RecipeContentS3BucketE74B8362";
            _stackResource.PhysicalResourceId = "PhysicalResourceId";
            _stackResource.ResourceType       = "AWS::S3::Bucket";
            _mockAWSResourceQueryer.Setup(x => x.DescribeCloudFormationResources(It.IsAny <string>())).Returns(Task.FromResult(_stackResources));
            _mockAWSResourceQueryer.Setup(x => x.GetS3BucketLocation(It.IsAny <string>())).Returns(Task.FromResult("us-west-2"));
            var disaplayedResourcesHandler = new DisplayedResourcesHandler(_mockAWSResourceQueryer.Object, _displayedResourcesFactory);

            var outputs = await disaplayedResourcesHandler.GetDeploymentOutputs(_cloudApplication, recommendation);

            var resource = outputs.First();

            Assert.Equal("PhysicalResourceId", resource.Id);
            Assert.Equal("AWS::S3::Bucket", resource.Type);
            Assert.Single(resource.Data);
            Assert.True(resource.Data.ContainsKey("Bucket Name"));
            Assert.Equal("PhysicalResourceId", resource.Data["Bucket Name"]);
        }
        public async Task GetDeploymentOutputs_UnknownType()
        {
            var engine = await BuildRecommendationEngine("ConsoleAppService");

            var recommendations = await engine.ComputeRecommendations();

            var recommendation = recommendations.First(r => r.Recipe.Id.Equals("ConsoleAppEcsFargateService"));

            _stackResource.LogicalResourceId  = "RecipeEcsClusterB4EDBB7E";
            _stackResource.PhysicalResourceId = "PhysicalResourceId";
            _stackResource.ResourceType       = "UnknownType";
            _mockAWSResourceQueryer.Setup(x => x.DescribeCloudFormationResources(It.IsAny <string>())).Returns(Task.FromResult(_stackResources));
            var disaplayedResourcesHandler = new DisplayedResourcesHandler(_mockAWSResourceQueryer.Object, _displayedResourcesFactory);

            var outputs = await disaplayedResourcesHandler.GetDeploymentOutputs(_cloudApplication, recommendation);

            Assert.Single(outputs);
            var resource = outputs.First();

            Assert.Equal("PhysicalResourceId", resource.Id);
            Assert.Equal("UnknownType", resource.Type);
            Assert.Empty(resource.Data);
        }