public async Task RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryTrafficClient(connection); await client.GetReferrers("fake", "repo"); connection.Received().GetAll <RepositoryTrafficReferrer>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/traffic/popular/referrers"), "application/vnd.github.spiderman-preview"); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryTrafficClient(connection); await client.GetPaths(1); connection.Received().GetAll <RepositoryTrafficPath>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/traffic/popular/paths"), "application/vnd.github.spiderman-preview"); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoryTrafficClient(connection); await client.GetReferrers("fake", "repo"); connection.Received().GetAll<RepositoryTrafficReferrer>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/traffic/popular/referrers"), "application/vnd.github.spiderman-preview"); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoryTrafficClient(connection); await client.GetPaths(1); connection.Received().GetAll<RepositoryTrafficPath>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/traffic/popular/paths"), "application/vnd.github.spiderman-preview"); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryTrafficClient(connection); await client.GetAllPaths("fake", "repo"); connection.Received().GetAll <RepositoryTrafficPath>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/traffic/popular/paths")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryTrafficClient(connection); await client.GetAllReferrers(1); connection.Received().GetAll <RepositoryTrafficReferrer>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/traffic/popular/referrers")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryTrafficClient(connection); var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day); await client.GetViews(1, per); connection.Received().Get <RepositoryTrafficViewSummary>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/traffic/views"), Arg.Is <Dictionary <string, string> >(s => s["per"] == "day"), "application/vnd.github.spiderman-preview"); }
public async Task EnsuresNonNullArguments() { var client = new RepositoryTrafficClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetPaths(null, "name")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetPaths("owner", null)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetPaths("", "name")); await Assert.ThrowsAsync<ArgumentException>(() => client.GetPaths("owner", "")); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryTrafficClient(connection); var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day); await client.GetViews("fake", "repo", per); connection.Received().Get <RepositoryTrafficViewSummary>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/traffic/views"), Arg.Is <Dictionary <string, string> >(s => s["per"] == "day")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryTrafficClient(connection); var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day); await client.GetClones(1, per); connection.Received().Get <RepositoryTrafficCloneSummary>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/traffic/clones"), Arg.Is <Dictionary <string, string> >(s => s["per"] == "day")); }
public async Task EnsuresNonNullArguments() { var client = new RepositoryTrafficClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetPaths(null, "name")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetPaths("owner", null)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetPaths("", "name")); await Assert.ThrowsAsync <ArgumentException>(() => client.GetPaths("owner", "")); }
public async Task EnsuresNonNullArguments() { var client = new RepositoryTrafficClient(Substitute.For <IApiConnection>()); var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetViews(null, "name", per)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetViews("owner", null, per)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetViews("owner", "name", null)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetViews("", "name", per)); await Assert.ThrowsAsync <ArgumentException>(() => client.GetViews("owner", "", per)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetViews(1, null)); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoryTrafficClient(connection); var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day); await client.GetClones("fake", "repo", per); connection.Received().Get<RepositoryTrafficCloneSummary>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/traffic/clones"), Arg.Is<Dictionary<string, string>>(s => s["per"] == "day"), "application/vnd.github.spiderman-preview"); }
public async Task EnsuresNonNullArguments() { var client = new RepositoryTrafficClient(Substitute.For<IApiConnection>()); var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetViews(null, "name", per)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetViews("owner", null, per)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetViews("owner", "name", null)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetViews("", "name", per)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetViews("owner", "", per)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetViews(1, null)); }