示例#1
0
            public void EnsuresNonNullArguments()
            {
                var client = new ReleasesClient(Substitute.For <IApiConnection>());

                Assert.Throws <ArgumentNullException>(() => client.Delete(null, "name", 1));
                Assert.Throws <ArgumentException>(() => client.Delete("", "name", 1));
                Assert.Throws <ArgumentNullException>(() => client.Delete("owner", null, 1));
                Assert.Throws <ArgumentException>(() => client.Delete("owner", "", 1));
            }
示例#2
0
            public async Task RequestsTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new ReleasesClient(connection);

                await client.Delete("fake", "repo", 1);

                connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/releases/1"));
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new ReleasesClient(Substitute.For<IApiConnection>());

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Delete(null, "name", 1));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Delete("owner", null, 1));

                await Assert.ThrowsAsync<ArgumentException>(() => client.Delete("", "name", 1));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Delete("owner", "", 1));
            }
            public async Task RequestsTheCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new ReleasesClient(connection);

                await client.Delete(1, 1);

                connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repositories/1/releases/1"));
            }
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new ReleasesClient(connection);

                client.Delete("fake", "repo", 1);

                connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/releases/1"));
            }