コード例 #1
0
            public void GetsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new RepositoryCommitsClient(connection);

                client.GetAll("owner", "name");

                connection.Received()
                    .GetAll<GitHubCommit>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/name/commits"),
                    Arg.Any<Dictionary<string, string>>());
            }
コード例 #2
0
            public void EnsureNonNullArguments()
            {
                var client = new RepositoryCommitsClient(Substitute.For<IApiConnection>());

                Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "repo"));
                Assert.Throws<ArgumentException>(() => client.GetAll("", "repo"));

                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null));
                Assert.Throws<ArgumentException>(() => client.GetAll("owner", ""));

                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "repo", null));
            }