public async Task ThrowsExceptionForInvalidStatusCodeWithRepositoryId() { var responseTask = TestSetup.CreateApiResponse(HttpStatusCode.Conflict); var connection = Substitute.For <IConnection>(); connection.Get <object>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/assignees/cody"), null, null) .Returns(responseTask); var apiConnection = Substitute.For <IApiConnection>(); apiConnection.Connection.Returns(connection); var client = new RepoCollaboratorsClient(apiConnection); await Assert.ThrowsAsync <ApiException>(() => client.IsCollaborator(1, "cody")); }