public async Task RequestsTheEmojiEndpoint()
            {
                IApiResponse<string> response = new ApiResponse<string>(new Response(), "<strong>Test</strong>");
                var connection = Substitute.For<IConnection>();
                var forTest = new NewArbitraryMarkdown("testMarkdown", "gfm", "testContext");
                connection.Post<string>(Args.Uri, forTest, "text/html", "text/plain")
                    .Returns(Task.FromResult(response));
                var client = new MiscellaneousClient(connection);

                var html = await client.RenderArbitraryMarkdown(forTest);
                Assert.Equal("<strong>Test</strong>", html);
                connection.Received()
                    .Post<string>(Arg.Is<Uri>(u => u.ToString() == "markdown"),
                    forTest,
                    "text/html",
                    "text/plain");
            }
Пример #2
0
            public async Task RequestsTheEmojiEndpoint()
            {
                IApiResponse <string> response = new ApiResponse <string>(new Response(), "<strong>Test</strong>");
                var connection = Substitute.For <IConnection>();
                var forTest    = new NewArbitraryMarkdown("testMarkdown", "gfm", "testContext");

                connection.Post <string>(Args.Uri, forTest, "text/html", "text/plain")
                .Returns(Task.FromResult(response));
                var client = new MiscellaneousClient(connection);

                var html = await client.RenderArbitraryMarkdown(forTest);

                Assert.Equal("<strong>Test</strong>", html);
                connection.Received()
                .Post <string>(Arg.Is <Uri>(u => u.ToString() == "markdown"),
                               forTest,
                               "text/html",
                               "text/plain");
            }
Пример #3
0
            public async Task RequestsTheMarkdownEndpoint()
            {
                var response = "<strong>Test</strong>";

                var payload = new NewArbitraryMarkdown("testMarkdown", "gfm", "testContext");

                var apiConnection = Substitute.For <IApiConnection>();

                apiConnection.Post <string>(Args.Uri, payload, "text/html", "text/plain")
                .Returns(Task.FromResult(response));

                var client = new MiscellaneousClient(apiConnection);

                var html = await client.RenderArbitraryMarkdown(payload);

                Assert.Equal("<strong>Test</strong>", html);
                apiConnection.Received()
                .Post <string>(Arg.Is <Uri>(u => u.ToString() == "markdown"),
                               payload,
                               "text/html",
                               "text/plain");
            }