Ejemplo n.º 1
0
            public async Task RendersLink(string path, string expected)
            {
                // Given
                TestExecutionContext context  = new TestExecutionContext();
                TestDocument         document = new TestDocument();

                KeyValuePair <string, string>[] args = new KeyValuePair <string, string>[]
                {
                    new KeyValuePair <string, string>("Path", path)
                };
                LinkShortcode shortcode = new LinkShortcode();

                // When
                TestDocument result = (TestDocument)await shortcode.ExecuteAsync(args, string.Empty, document, context);

                // Then
                result.Content.ShouldBe(expected);
            }
Ejemplo n.º 2
0
            public void RendersLink(string path, string expected)
            {
                // Given
                TestExecutionContext context  = new TestExecutionContext();
                TestDocument         document = new TestDocument();

                KeyValuePair <string, string>[] args = new KeyValuePair <string, string>[]
                {
                    new KeyValuePair <string, string>("Path", path)
                };
                LinkShortcode shortcode = new LinkShortcode();

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

                // Then
                result.ContentProvider.GetStream().ReadToEnd().ShouldBe(expected);
            }
Ejemplo n.º 3
0
            public async Task RendersLinkWithAlternateHost(string path, string expected)
            {
                // Given
                TestExecutionContext context = new TestExecutionContext();

                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")
                };
                LinkShortcode shortcode = new LinkShortcode();

                // When
                TestDocument result = (TestDocument)await shortcode.ExecuteAsync(args, string.Empty, document, context);

                // Then
                result.Content.ShouldBe(expected);
            }
Ejemplo n.º 4
0
            public void RendersLinkWithAlternateHost(string path, string expected)
            {
                // Given
                TestExecutionContext context = new TestExecutionContext();

                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")
                };
                LinkShortcode shortcode = new LinkShortcode();

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

                // Then
                result.ContentProvider.GetStream().ReadToEnd().ShouldBe(expected);
            }