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

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

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

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

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

                await Assert.ThrowsAsync<ArgumentException>(() => client.DeleteAsset("", "name", 1));
                await Assert.ThrowsAsync<ArgumentException>(() => client.DeleteAsset("owner", "", 1));
            }
コード例 #4
0
            public async Task RequestsTheCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new ReleasesClient(connection);

                await client.DeleteAsset(1, 1);

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

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

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