Ejemplo n.º 1
0
        protected override void WriteContent(TextWriter writer)
        {
            base.WriteContent(writer);

            if (ShouldEmitRewriteRule)
            {
                var links = GetSeeAlsoLinks();
                if (links != null)
                {
                    foreach (var link in links)
                    {
                        string serviceId;
                        string shape;

                        if (SDKDocRedirectWriter.ExtractServiceIDAndShapeFromUrl(link, out serviceId, out shape))
                        {
                            string docPath = string.Format("{0}{1}/{2}",
                                                           SDKDocRedirectWriter.DocPathPrefix,
                                                           GenerateFilepath(),
                                                           GenerateFilename().Replace('\\', '/'));
                            SDKDocRedirectWriter.AddRule(serviceId, shape, docPath);
                            break;
                        }
                    }
                }
            }
        }
        public void ExtractFromUrlTest()
        {
            string serviceId;
            string shape;

            Assert.True(SDKDocRedirectWriter.ExtractServiceIDAndShapeFromUrl("http://docs.aws.amazon.com/goto/WebAPI/streams-dynamodb-2012-08-10/DescribeStream", out serviceId, out shape));
            Assert.Equal("streams-dynamodb-2012-08-10", serviceId);
            Assert.Equal("DescribeStream", shape);

            Assert.True(SDKDocRedirectWriter.ExtractServiceIDAndShapeFromUrl("http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ResetImageAttribute", out serviceId, out shape));
            Assert.Equal("ec2-2016-11-15", serviceId);
            Assert.Equal("ResetImageAttribute", shape);
        }