public void CloudFormationStack_GetLocalPathAndEmptyS3Bucket(string localPath)
        {
            var dataSource = new FakeUpdatableResourceDataSource(
                new Dictionary <string, string>
            {
                { "TemplateUrl", localPath }
            });
            var resource = new UpdatableResource("TestResource", UpdatableResourceDefinition.DEF_CLOUDFORMATION_STACK, dataSource);

            Assert.Equal(localPath, resource.Fields[0].GetLocalPath());

            resource.Fields[0].SetS3Location("my-bucket", "swagger.yml");
            Assert.Equal("s3://my-bucket/swagger.yml", dataSource.GetValue("TemplateUrl"));
        }
        public void ServerlessApi_GetLocalPathAndEmptyS3Bucket(string localPath)
        {
            var dataSource = new FakeUpdatableResourceDataSource(
                new Dictionary <string, string>
            {
                { "DefinitionUri", localPath }
            });
            var resource = new UpdatableResource("TestResource", UpdatableResourceDefinition.DEF_SERVERLESS_API, dataSource);

            Assert.Equal(localPath, resource.Fields[0].GetLocalPath());

            resource.Fields[0].SetS3Location("my-bucket", "swagger.yml");
            Assert.Equal("s3://my-bucket/swagger.yml", dataSource.GetValue("DefinitionUri"));
        }
        public void AppSyncGraphQl_GetLocalPathAndEmptyS3Bucket(string localPath)
        {
            var dataSource = new FakeUpdatableResourceDataSource(
                new Dictionary <string, string>
            {
                { "DefinitionS3Location", localPath }
            });
            var resource = new UpdatableResource("TestResource", UpdatableResourceDefinition.DEF_APPSYNC_GRAPHQLSCHEMA, dataSource);

            Assert.Equal(localPath, resource.Fields[0].GetLocalPath());

            resource.Fields[0].SetS3Location("my-bucket", "swagger.yml");
            Assert.Equal("s3://my-bucket/swagger.yml", dataSource.GetValue("DefinitionS3Location"));
        }
        public void LambdaFunction_GetCurrentDirectoryForWithNullCode()
        {
            var dataSource = new FakeUpdatableResourceDataSource(
                new Dictionary <string, string>
            {
            });
            var resource = new UpdatableResource("TestResource", UpdatableResourceDefinition.DEF_LAMBDA_FUNCTION, dataSource);

            Assert.Equal(".", resource.Fields[0].GetLocalPath());

            resource.Fields[0].SetS3Location("my-bucket", "my.zip");
            Assert.Equal("my-bucket", dataSource.GetValue("Code/S3Bucket"));
            Assert.Equal("my.zip", dataSource.GetValue("Code/S3Key"));
        }
        public void ServerlessFunction_GetLocalPath(string localPath)
        {
            var dataSource = new FakeUpdatableResourceDataSource(
                new Dictionary <string, string>
            {
                { "CodeUri", localPath }
            });
            var resource = new UpdatableResource("TestResource", UpdatableResourceDefinition.DEF_SERVERLESS_FUNCTION, dataSource);

            Assert.Equal(localPath, resource.Fields[0].GetLocalPath());

            resource.Fields[0].SetS3Location("my-bucket", "my.zip");
            Assert.Equal("s3://my-bucket/my.zip", dataSource.GetValue("CodeUri"));
        }
        public void ElasticBeanstalkApplicationVersion_GetLocalPathAndEmptyS3Bucket(string localPath)
        {
            var dataSource = new FakeUpdatableResourceDataSource(
                new Dictionary <string, string>
            {
                { "SourceBundle/S3Key", localPath }
            });
            var resource = new UpdatableResource("TestResource", UpdatableResourceDefinition.DEF_ELASTICBEANSTALK_APPLICATIONVERSION, dataSource);

            Assert.Equal(localPath, resource.Fields[0].GetLocalPath());

            resource.Fields[0].SetS3Location("my-bucket", localPath);
            Assert.Equal("my-bucket", dataSource.GetValue("SourceBundle/S3Bucket"));
            Assert.Equal(localPath, dataSource.GetValue("SourceBundle/S3Key"));
        }
        public void ApiGatewayApi_GetLocalPathAndEmptyS3Bucket(string localPath)
        {
            var dataSource = new FakeUpdatableResourceDataSource(
                new Dictionary <string, string>
            {
                { "BodyS3Location/Key", localPath }
            });
            var resource = new UpdatableResource("TestResource", UpdatableResourceDefinition.DEF_APIGATEWAY_RESTAPI, dataSource);

            Assert.Equal(localPath, resource.Fields[0].GetLocalPath());

            resource.Fields[0].SetS3Location("my-bucket", localPath);
            Assert.Equal("my-bucket", dataSource.GetValue("BodyS3Location/Bucket"));
            Assert.Equal(localPath, dataSource.GetValue("BodyS3Location/Key"));
        }
        public void LambdaFunction_GetLocalPathAndEmptyS3Bucket(string localPath)
        {
            var dataSource = new FakeUpdatableResourceDataSource(
                new Dictionary <string, string>
            {
                { "Code/S3Bucket", "" },
                { "Code/S3Key", localPath }
            });
            var resource = new UpdatableResource("TestResource", UpdatableResourceDefinition.DEF_LAMBDA_FUNCTION, dataSource);

            Assert.Equal(localPath, resource.Fields[0].GetLocalPath());

            resource.Fields[0].SetS3Location("my-bucket", "my.zip");
            Assert.Equal("my-bucket", dataSource.GetValue("Code/S3Bucket"));
            Assert.Equal("my.zip", dataSource.GetValue("Code/S3Key"));
        }
        public void AppSyncResolver_GetLocalPathAndEmptyS3Bucket()
        {
            var dataSource = new FakeUpdatableResourceDataSource(
                new Dictionary <string, string>
            {
                { "ResponseMappingTemplateS3Location", "response.xml" },
                { "RequestMappingTemplateS3Location", "request.xml" }
            });
            var resource = new UpdatableResource("TestResource", UpdatableResourceDefinition.DEF_APPSYNC_RESOLVER, dataSource);

            Assert.Equal("response.xml", resource.Fields[0].GetLocalPath());
            Assert.Equal("request.xml", resource.Fields[1].GetLocalPath());

            resource.Fields[0].SetS3Location("my-bucket", "response.xml-updated");
            Assert.Equal("s3://my-bucket/response.xml-updated", dataSource.GetValue("ResponseMappingTemplateS3Location"));
            resource.Fields[1].SetS3Location("my-bucket", "request.xml-updated");
            Assert.Equal("s3://my-bucket/request.xml-updated", dataSource.GetValue("RequestMappingTemplateS3Location"));
        }