public void RequestsCorrectUrl3() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoryContentsClient(gitHubClient); client.GetArchive("org", "repo", ArchiveFormat.Zipball, "ref"); gitHubClient.Received().Repository.Content.GetArchive("org", "repo", ArchiveFormat.Zipball, "ref"); }
public void RequestsCorrectUrl4WithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoryContentsClient(gitHubClient); client.GetArchive(1, ArchiveFormat.Zipball, "ref", TimeSpan.FromMinutes(60)); gitHubClient.Received().Repository.Content.GetArchive(1, ArchiveFormat.Zipball, "ref", TimeSpan.FromMinutes(60)); }
public void RequestsCorrectUrl1WithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoryContentsClient(gitHubClient); client.GetArchive(1); gitHubClient.Received().Repository.Content.GetArchive(1); }
public void EnsuresNonNullArguments() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoryContentsClient(gitHubClient); Assert.Throws <ArgumentNullException>(() => client.GetArchive(null, "repo")); Assert.Throws <ArgumentNullException>(() => client.GetArchive("org", null)); Assert.Throws <ArgumentNullException>(() => client.GetArchive(null, "repo", ArchiveFormat.Tarball)); Assert.Throws <ArgumentNullException>(() => client.GetArchive("org", null, ArchiveFormat.Tarball)); Assert.Throws <ArgumentNullException>(() => client.GetArchive(null, "repo", ArchiveFormat.Tarball, "ref")); Assert.Throws <ArgumentNullException>(() => client.GetArchive("org", null, ArchiveFormat.Tarball, "ref")); Assert.Throws <ArgumentNullException>(() => client.GetArchive("org", "repo", ArchiveFormat.Tarball, null)); Assert.Throws <ArgumentNullException>(() => client.GetArchive(null, "repo", ArchiveFormat.Tarball, "ref", TimeSpan.MaxValue)); Assert.Throws <ArgumentNullException>(() => client.GetArchive("org", null, ArchiveFormat.Tarball, "ref", TimeSpan.MaxValue)); Assert.Throws <ArgumentNullException>(() => client.GetArchive("org", "repo", ArchiveFormat.Tarball, null, TimeSpan.MaxValue)); Assert.Throws <ArgumentNullException>(() => client.GetArchive(1, ArchiveFormat.Tarball, null)); Assert.Throws <ArgumentNullException>(() => client.GetArchive(1, ArchiveFormat.Tarball, null, TimeSpan.MaxValue)); Assert.Throws <ArgumentException>(() => client.GetArchive("", "repo")); Assert.Throws <ArgumentException>(() => client.GetArchive("org", "")); Assert.Throws <ArgumentException>(() => client.GetArchive("", "repo", ArchiveFormat.Tarball)); Assert.Throws <ArgumentException>(() => client.GetArchive("org", "", ArchiveFormat.Tarball)); Assert.Throws <ArgumentException>(() => client.GetArchive("", "repo", ArchiveFormat.Tarball, "ref")); Assert.Throws <ArgumentException>(() => client.GetArchive("org", "", ArchiveFormat.Tarball, "ref")); Assert.Throws <ArgumentException>(() => client.GetArchive("", "repo", ArchiveFormat.Tarball, "ref", TimeSpan.MaxValue)); Assert.Throws <ArgumentException>(() => client.GetArchive("org", "", ArchiveFormat.Tarball, "ref", TimeSpan.MaxValue)); Assert.Throws <ArgumentException>(() => client.GetArchive("org", "repo", ArchiveFormat.Tarball, "ref", TimeSpan.Zero)); Assert.Throws <ArgumentException>(() => client.GetArchive(1, ArchiveFormat.Tarball, "ref", TimeSpan.Zero)); }