public void RequestUriShouldBeBuiltCorrectlyWithArgs() { var mockResponse = new HttpResponseMessage(HttpStatusCode.OK); mockResponse.Content = new StringContent("{\"Objects\":[{\"Hash\":\"QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec\",\"Links\":[{\"Name\":\"about\",\"Hash\":\"QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V\",\"Size\":1688,\"Type\":2},{\"Name\":\"contact\",\"Hash\":\"QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y\",\"Size\":200,\"Type\":2},{\"Name\":\"help\",\"Hash\":\"QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7\",\"Size\":322,\"Type\":2},{\"Name\":\"quick-start\",\"Hash\":\"QmXifYTiYxz8Nxt3LmjaxtQNLYkjdh324L4r81nZSadoST\",\"Size\":1707,\"Type\":2},{\"Name\":\"readme\",\"Hash\":\"QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB\",\"Size\":1102,\"Type\":2},{\"Name\":\"security-notes\",\"Hash\":\"QmTumTjvcYCAvRRwQ8sDRxh8ezmrcr88YFU7iYNroGGTBZ\",\"Size\":1027,\"Type\":2}]}]}\n"); var mockHttpMessageHandler = new MockHttpMessageHandler(mockResponse); string mockAddress = "http://127.0.0.1:5001"; string mockHash = "QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec"; string expectedRequestUri = String.Format("{0}/api/v0/ls?arg={1}", mockAddress, mockHash); using (var client = new IpfsClient(new Uri(mockAddress), new HttpClient(mockHttpMessageHandler))) { client.Ls(mockHash).Wait(); } Assert.IsTrue(Equals(mockHttpMessageHandler.LastRequest.RequestUri, expectedRequestUri)); }