Пример #1
0
            public async Task EnsuresNonNullOrEmptyArguments()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new TeamsClient(connection);

                // Check owner arguments.
                await Assert.ThrowsAsync <ArgumentNullException>(() => client.RemoveRepository(1, null, "repoName"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.RemoveRepository(1, "", "repoName"));

                // Check repo arguments.
                await Assert.ThrowsAsync <ArgumentNullException>(() => client.RemoveRepository(1, "ownerName", null));

                await Assert.ThrowsAsync <ArgumentException>(() => client.RemoveRepository(1, "ownerName", ""));
            }
Пример #2
0
            public async Task RequestsTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new TeamsClient(connection);
                await client.RemoveRepository(1, "org", "repo");

                connection.Connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "teams/1/repos/org/repo"));
            }
            public void RequestsTheCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new TeamsClient(connection);
                client.RemoveRepository(1, "org", "repo");

                connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "teams/1/repos/org/repo"));
            }
Пример #4
0
            public async Task EnsuresNonNullOrEmptyArguments()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new TeamsClient(connection);

                // Check owner arguments.
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.RemoveRepository(1, null, "repoName"));
                await Assert.ThrowsAsync<ArgumentException>(() => client.RemoveRepository(1, "", "repoName"));

                // Check repo arguments.
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.RemoveRepository(1, "ownerName", null));
                await Assert.ThrowsAsync<ArgumentException>(() => client.RemoveRepository(1, "ownerName", ""));
            }