public void RendersLinkWithAlternateHost(string path, string expected)
            {
                // Given
                TestExecutionContext context = new TestExecutionContext();

                context.AddTypeConversion <string, FilePath>(x => new FilePath(x));
                context.AddTypeConversion <string, bool>(x => bool.Parse(x));
                context.Settings[Keys.Host] = "domain.com";
                TestDocument document = new TestDocument();

                KeyValuePair <string, string>[] args = new KeyValuePair <string, string>[]
                {
                    new KeyValuePair <string, string>("Path", path),
                    new KeyValuePair <string, string>("Host", "google.com")
                };
                Link shortcode = new Link();

                // When
                IShortcodeResult result = shortcode.Execute(args, string.Empty, document, context);

                // Then
                using (TextReader reader = new StreamReader(result.Stream))
                {
                    reader.ReadToEnd().ShouldBe(expected);
                }
            }
            public void DoesNotChangeImageDomain()
            {
                // Given
                TestExecutionContext context = new TestExecutionContext();

                context.AddTypeConversion <string, Uri>(x => new Uri(x));
                context.Settings[Keys.Host] = "buzz.com";
                TestDocument document = new TestDocument(new Dictionary <string, object>
                {
                    { Keys.RelativeFilePath, new FilePath("fizz/buzz") },
                    { FeedKeys.Image, new Uri("http://foo.com/bar/baz.png") }
                });

                document.AddTypeConversion <Uri, string>(x => x.ToString());
                document.AddTypeConversion <FilePath, string>(x => x.FullPath);
                GenerateFeeds module = new GenerateFeeds();

                // When
                IList <IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                results.Select(x => x.FilePath(Keys.WritePath).FullPath).ShouldBe(new[] { "feed.rss", "feed.atom" }, true);
                results[0].Content.ShouldContain("http://foo.com/bar/baz.png");
            }
            public void RendersTableWithSettings()
            {
                // Given
                TestExecutionContext context = new TestExecutionContext();

                context.AddTypeConversion <string, int>(x => int.Parse(x));
                TestDocument document = new TestDocument();
                string       content  = @"
1 2 ""3 4""
a ""b c"" d
e f g
5 678
""h i""  j ""k""
l=m nop
";

                KeyValuePair <string, string>[] args = new KeyValuePair <string, string>[]
                {
                    new KeyValuePair <string, string>("Class", "tclass"),
                    new KeyValuePair <string, string>("HeaderRows", "1"),
                    new KeyValuePair <string, string>("FooterRows", "2"),
                    new KeyValuePair <string, string>("HeaderCols", "1"),
                    new KeyValuePair <string, string>("HeaderClass", "hclass"),
                    new KeyValuePair <string, string>("BodyClass", "bclass"),
                    new KeyValuePair <string, string>("FooterClass", "fclass")
                };
                Table shortcode = new Table();

                // When
                IShortcodeResult result = shortcode.Execute(args, content, document, context);

                // Then
                using (TextReader reader = new StreamReader(result.Stream))
                {
                    reader.ReadToEnd().ShouldBe(
                        @"<table class=""tclass"">
  <thead class=""hclass"">
    <tr>
      <th>1</th>
      <th>2</th>
      <th>3 4</th>
    </tr>
  </thead>
  <tbody class=""bclass"">
    <tr>
      <th>a</th>
      <td>b c</td>
      <td>d</td>
    </tr>
    <tr>
      <th>e</th>
      <td>f</td>
      <td>g</td>
    </tr>
    <tr>
      <th>5</th>
      <td>678</td>
    </tr>
  </tbody>
  <tfoot class=""fclass"">
    <tr>
      <th>h i</th>
      <td>j</td>
      <td>k</td>
    </tr>
    <tr>
      <th>l=m</th>
      <td>nop</td>
    </tr>
  </tfoot>
</table>",
                        StringCompareShould.IgnoreLineEndings);
                }
            }