public async Task EnsuresNonNullArguments() { var client = new TagsClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "name", new NewTag())); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", null, new NewTag())); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", "name", null)); await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "name", new NewTag())); await Assert.ThrowsAsync<ArgumentException>(() => client.Create("owner", "", new NewTag())); }
public void PostsToTheCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new TagsClient(connection); client.Create("owner", "repo", new NewTag { Type = TaggedType.Tree }); connection.Received().Post<GitTag>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/repo/git/tags"), Arg.Is<NewTag>(nt => nt.Type == TaggedType.Tree)); }