public void EnsuresNonNullArguments() { var client = new ObservableRepositoryTrafficClient(Substitute.For<IGitHubClient>()); var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day); Assert.Throws<ArgumentNullException>(() => client.GetViews(null, "name", per)); Assert.Throws<ArgumentNullException>(() => client.GetViews("owner", null, per)); Assert.Throws<ArgumentNullException>(() => client.GetViews("owner", "name", null)); Assert.Throws<ArgumentException>(() => client.GetViews("", "name", per)); Assert.Throws<ArgumentException>(() => client.GetViews("owner", "", per)); Assert.Throws<ArgumentNullException>(() => client.GetViews(1, null)); }
public void RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryTrafficClient(gitHubClient); var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day); client.GetViews(1, per); gitHubClient.Received().Repository.Traffic.GetViews(1, per); }