Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

get username out of user search github api call

  • Loading branch information...
commit 9bded767067e3629e6147acf3cfe1918162ac685 1 parent 877017a
@robertgreiner authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 gitcv.Tests/Models/Services/GithubServiceTests.cs
View
13 gitcv.Tests/Models/Services/GithubServiceTests.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Net;
using System.Text;
@@ -27,5 +28,17 @@ public void ShouldReturnUserSpecificContentOnValidGithubUsername()
response.Close();
Assert.IsTrue(response.ContentLength > 12);
}
+
+ [Test]
+ public void ShouldReturnGithubUsernameWithBasicGithubUserSearch()
+ {
+ var request = WebRequest.Create("https://github.com/api/v2/json/user/search/robertgreiner") as HttpWebRequest;
+ var response = request.GetResponse() as HttpWebResponse;
+ var receiveStream = response.GetResponseStream();
+ var readStream = new StreamReader(receiveStream, Encoding.UTF8);
+ var stream = readStream.ReadToEnd();
+ response.Close();
+ Assert.IsTrue(stream.Contains("\"username\":\"robertgreiner\""));
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.