Exemple #1
0
        public void TestBuildWithXrefService()
        {
            var fakeResponseHandler = new FakeResponseHandler();

            fakeResponseHandler.AddFakeResponse(new Uri("http://example.org/test1"), new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("[]")
            });
            fakeResponseHandler.AddFakeResponse(new Uri("http://example.org/test2"), new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("[{'uid':'csharp_coding_standards', 'name':'C# Coding Standards', 'href':'http://dotnet.github.io/docfx/guideline/csharp_coding_standards.html'}]")
            });

            var httpClient = new HttpClient(fakeResponseHandler);
            var dbc        = new DocumentBuildContext("");

            var result = dbc.QueryByHttpRequestAsync(httpClient, "http://example.org/test1", "xx").Result;

            Assert.Equal(0, result.Count);
            result = dbc.QueryByHttpRequestAsync(httpClient, "http://example.org/test2", "xx").Result;
            Assert.Equal("csharp_coding_standards", result[0].Uid);
        }