{"action":"created","issue":{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1225","repository_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck","labels_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1225/labels{/name}","comments_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1225/comments","events_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1225/events","html_url":"https://github.com/rubberduck-vba/Rubberduck/issues/1225","id":142446259,"number":1225,"title":"Extract Method refactoring needs thorough testing","user":{"login":"retailcoder","id":5751684,"avatar_url":"https://avatars.githubusercontent.com/u/5751684?v=3","gravatar_id":"","url":"https://api.github.com/users/retailcoder","html_url":"https://github.com/retailcoder","followers_url":"https://api.github.com/users/retailcoder/followers","following_url":"https://api.github.com/users/retailcoder/following{/other_user}","gists_url":"https://api.github.com/users/retailcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/retailcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retailcoder/subscriptions","organizations_url":"https://api.github.com/users/retailcoder/orgs","repos_url":"https://api.github.com/users/retailcoder/repos","events_url":"https://api.github.com/users/retailcoder/events{/privacy}","received_events_url":"https://api.github.com/users/retailcoder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/labels/critical","name":"critical","color":"DD0000"},{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/labels/QualityControl","name":"QualityControl","color":"0077AA"},{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/labels/refactorings","name":"refactorings","color":"DDDDDd"}],"state":"open","locked":false,"assignee":{"login":"grleachman","id":645821,"avatar_url":"https://avatars.githubusercontent.com/u/645821?v=3","gravatar_id":"","url":"https://api.github.com/users/grleachman","html_url":"https://github.com/grleachman","followers_url":"https://api.github.com/users/grleachman/followers","following_url":"https://api.github.com/users/grleachman/following{/other_user}","gists_url":"https://api.github.com/users/grleachman/gists{/gist_id}","starred_url":"https://api.github.com/users/grleachman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grleachman/subscriptions","organizations_url":"https://api.github.com/users/grleachman/orgs","repos_url":"https://api.github.com/users/grleachman/repos","events_url":"https://api.github.com/users/grleachman/events{/privacy}","received_events_url":"https://api.github.com/users/grleachman/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/milestones/20","html_url":"https://github.com/rubberduck-vba/Rubberduck/milestones/Version%202.0","labels_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/milestones/20/labels","id":1063094,"number":20,"title":"Version 2.0","description":"This version will include source control (GitHub) integration, WPF controls in dockable hosts, many more refactorings and inspections, and lots of bug fixes.","creator":{"login":"retailcoder","id":5751684,"avatar_url":"https://avatars.githubusercontent.com/u/5751684?v=3","gravatar_id":"","url":"https://api.github.com/users/retailcoder","html_url":"https://github.com/retailcoder","followers_url":"https://api.github.com/users/retailcoder/followers","following_url":"https://api.github.com/users/retailcoder/following{/other_user}","gists_url":"https://api.github.com/users/retailcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/retailcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retailcoder/subscriptions","organizations_url":"https://api.github.com/users/retailcoder/orgs","repos_url":"https://api.github.com/users/retailcoder/repos","events_url":"https://api.github.com/users/retailcoder/events{/privacy}","received_events_url":"https://api.github.com/users/retailcoder/received_events","type":"User","site_admin":false},"open_issues":75,"closed_issues":216,"state":"open","created_at":"2015-04-11T13:20:05Z","updated_at":"2016-05-02T23:57:56Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-03-21T19:24:24Z","updated_at":"2016-05-03T16:39:38Z","closed_at":null,"body":"This refactoring is currently covered by exactly one, basic-basic-basic test, and it's one of the most complex refactorings we have... and I don't think I touched that code since, ....v1.3 or so.\r\n\r\nWe need tests that validate that...\r\n\r\n - When the selection is invalid (i.e. does not start in the same member it's ending in), `ExtractMethodPresenterFactory` returns a `null` presenter.\r\n - When a local variable/constant is only used within the selection, its declaration is moved to the extracted method\r\n - When a local variable/constant is only used before the selection, its declaration remains where it was\r\n - When a local variable/constant is only used after the selection, its declaration remains where it was\r\n - When a local variable/constant is used before and within the selection, it's considered an input\r\n - When a local variable/constant is used after and within the selection, it's considered an output\r\n - When there is no output needed, refactoring extracts a `Sub`\r\n - When there is only one possible output, refactoring extracts a `Function` and returns that value/reference\r\n - When the return value is a reference, the return assignment is `Set`\r\n - When there are multiple possible outputs, refactoring extracts a `Function` and returns whichever selected output the user selected; other outputs are `ByRef` parameters\r\n - When the selection contains a line label that is referred to before the selection, the selection should be deemed invalid. This rules out extracting `ErrHandler` subroutines and avoids having to deal with `Return` and `Resume` statements.\r\n - When the selection contains a line label that is only referred to within the selection, the line label and its reference(s) should be moved to the new method.\r\n\r\nThere's probably more to cover, but that would already be **much** better than the one happy-see-it-works test we have now."},"comment":{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/comments/216588545","html_url":"https://github.com/rubberduck-vba/Rubberduck/issues/1225#issuecomment-216588545","issue_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/1225","id":216588545,"user":{"login":"grleachman","id":645821,"avatar_url":"https://avatars.githubusercontent.com/u/645821?v=3","gravatar_id":"","url":"https://api.github.com/users/grleachman","html_url":"https://github.com/grleachman","followers_url":"https://api.github.com/users/grleachman/followers","following_url":"https://api.github.com/users/grleachman/following{/other_user}","gists_url":"https://api.github.com/users/grleachman/gists{/gist_id}","starred_url":"https://api.github.com/users/grleachman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grleachman/subscriptions","organizations_url":"https://api.github.com/users/grleachman/orgs","repos_url":"https://api.github.com/users/grleachman/repos","events_url":"https://api.github.com/users/grleachman/events{/privacy}","received_events_url":"https://api.github.com/users/grleachman/received_events","type":"User","site_admin":false},"created_at":"2016-05-03T16:39:38Z","updated_at":"2016-05-03T16:39:38Z","body":"TDD demands that you define what you want to happen before you write any application code."}}