{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/autorest/pulls/comments/76904405","id":76904405,"diff_hunk":"@@ -0,0 +1,70 @@\n+// Copyright (c) Microsoft Corporation. All rights reserved.\n+// Licensed under the MIT License. See License.txt in the project root for license information.\n+// \n+\n+using System.Linq;\n+using System.Reflection;\n+using System.Threading.Tasks;\n+using Microsoft.CodeAnalysis;\n+using Xunit;\n+using Xunit.Abstractions;\n+\n+namespace AutoRest.CSharp.Unit.Tests\n+{\n+    public class NameCollision : BugTest\n+    {\n+        public NameCollision(ITestOutputHelper output) : base(output)\n+        {\n+        }\n+\n+        [Fact]\n+        public async Task SupportModelNameCollisions()\n+        {\n+            // simplified test pattern for unit testing aspects of code generation\n+            using (var fileSystem = GenerateCodeForTestFromSpec())\n+            {\n+                // Expected Files\n+                Assert.True(fileSystem.FileExists(@\"GeneratedCode\\Models\\Action.cs\"));\n+                Assert.True(fileSystem.FileExists(@\"GeneratedCode\\Models\\HttpOperationResponse.cs\"));\n+\n+                var result = await Compile(fileSystem);\n+\n+                // filter the warnings\n+                var warnings = result.Messages.Where(\n+                    each => each.Severity == DiagnosticSeverity.Warning\n+                            && !SuppressWarnings.Contains(each.Id)).ToArray();\n+\n+                // use this to dump the files to disk for examination \n+                fileSystem.SaveFilesToTemp(\"name_collision\");","path":"src/generator/AutoRest.CSharp.Unit.Tests/NameCollision.cs","position":38,"original_position":38,"commit_id":"ae53f0f6fa511860743a03bf2c23348a80a5333d","original_commit_id":"ae53f0f6fa511860743a03bf2c23348a80a5333d","user":{"login":"John-Hart","id":17861711,"avatar_url":"https://avatars.githubusercontent.com/u/17861711?v=3","gravatar_id":"","url":"https://api.github.com/users/John-Hart","html_url":"https://github.com/John-Hart","followers_url":"https://api.github.com/users/John-Hart/followers","following_url":"https://api.github.com/users/John-Hart/following{/other_user}","gists_url":"https://api.github.com/users/John-Hart/gists{/gist_id}","starred_url":"https://api.github.com/users/John-Hart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/John-Hart/subscriptions","organizations_url":"https://api.github.com/users/John-Hart/orgs","repos_url":"https://api.github.com/users/John-Hart/repos","events_url":"https://api.github.com/users/John-Hart/events{/privacy}","received_events_url":"https://api.github.com/users/John-Hart/received_events","type":"User","site_admin":false},"body":"do you want to save this file every time the test is run?","created_at":"2016-08-31T00:19:21Z","updated_at":"2016-08-31T00:19:21Z","html_url":"https://github.com/Azure/autorest/pull/1386#discussion_r76904405","pull_request_url":"https://api.github.com/repos/Azure/autorest/pulls/1386","_links":{"self":{"href":"https://api.github.com/repos/Azure/autorest/pulls/comments/76904405"},"html":{"href":"https://github.com/Azure/autorest/pull/1386#discussion_r76904405"},"pull_request":{"href":"https://api.github.com/repos/Azure/autorest/pulls/1386"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/autorest/pulls/1386","id":83366621,"html_url":"https://github.com/Azure/autorest/pull/1386","diff_url":"https://github.com/Azure/autorest/pull/1386.diff","patch_url":"https://github.com/Azure/autorest/pull/1386.patch","issue_url":"https://api.github.com/repos/Azure/autorest/issues/1386","number":1386,"state":"open","locked":false,"title":"Adding a test to make sure our generated code does not cause collisions","user":{"login":"tbombach","id":779479,"avatar_url":"https://avatars.githubusercontent.com/u/779479?v=3","gravatar_id":"","url":"https://api.github.com/users/tbombach","html_url":"https://github.com/tbombach","followers_url":"https://api.github.com/users/tbombach/followers","following_url":"https://api.github.com/users/tbombach/following{/other_user}","gists_url":"https://api.github.com/users/tbombach/gists{/gist_id}","starred_url":"https://api.github.com/users/tbombach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbombach/subscriptions","organizations_url":"https://api.github.com/users/tbombach/orgs","repos_url":"https://api.github.com/users/tbombach/repos","events_url":"https://api.github.com/users/tbombach/events{/privacy}","received_events_url":"https://api.github.com/users/tbombach/received_events","type":"User","site_admin":false},"body":"This test would have failed before `usings` directives were removed from generated code. The `HttpOperationResponse` model is a bit silly, but `Action` is a better example. The user has to avoid this model name (for all of the generated languages), simply because it's defined in `System` in C#.\r\n\r\nOnce we add some more processing to remove the fully qualified names from generated code as much as possible, this test should still pass (since it checks errors and warnings).","created_at":"2016-08-30T23:44:04Z","updated_at":"2016-08-31T00:19:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9cb53dc94911c132e7bc45c7300325a628a725e1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/autorest/pulls/1386/commits","review_comments_url":"https://api.github.com/repos/Azure/autorest/pulls/1386/comments","review_comment_url":"https://api.github.com/repos/Azure/autorest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/autorest/issues/1386/comments","statuses_url":"https://api.github.com/repos/Azure/autorest/statuses/ae53f0f6fa511860743a03bf2c23348a80a5333d","head":{"label":"tbombach:collision-test","ref":"collision-test","sha":"ae53f0f6fa511860743a03bf2c23348a80a5333d","user":{"login":"tbombach","id":779479,"avatar_url":"https://avatars.githubusercontent.com/u/779479?v=3","gravatar_id":"","url":"https://api.github.com/users/tbombach","html_url":"https://github.com/tbombach","followers_url":"https://api.github.com/users/tbombach/followers","following_url":"https://api.github.com/users/tbombach/following{/other_user}","gists_url":"https://api.github.com/users/tbombach/gists{/gist_id}","starred_url":"https://api.github.com/users/tbombach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbombach/subscriptions","organizations_url":"https://api.github.com/users/tbombach/orgs","repos_url":"https://api.github.com/users/tbombach/repos","events_url":"https://api.github.com/users/tbombach/events{/privacy}","received_events_url":"https://api.github.com/users/tbombach/received_events","type":"User","site_admin":false},"repo":{"id":53884026,"name":"autorest","full_name":"tbombach/autorest","owner":{"login":"tbombach","id":779479,"avatar_url":"https://avatars.githubusercontent.com/u/779479?v=3","gravatar_id":"","url":"https://api.github.com/users/tbombach","html_url":"https://github.com/tbombach","followers_url":"https://api.github.com/users/tbombach/followers","following_url":"https://api.github.com/users/tbombach/following{/other_user}","gists_url":"https://api.github.com/users/tbombach/gists{/gist_id}","starred_url":"https://api.github.com/users/tbombach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbombach/subscriptions","organizations_url":"https://api.github.com/users/tbombach/orgs","repos_url":"https://api.github.com/users/tbombach/repos","events_url":"https://api.github.com/users/tbombach/events{/privacy}","received_events_url":"https://api.github.com/users/tbombach/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tbombach/autorest","description":"","fork":true,"url":"https://api.github.com/repos/tbombach/autorest","forks_url":"https://api.github.com/repos/tbombach/autorest/forks","keys_url":"https://api.github.com/repos/tbombach/autorest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tbombach/autorest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tbombach/autorest/teams","hooks_url":"https://api.github.com/repos/tbombach/autorest/hooks","issue_events_url":"https://api.github.com/repos/tbombach/autorest/issues/events{/number}","events_url":"https://api.github.com/repos/tbombach/autorest/events","assignees_url":"https://api.github.com/repos/tbombach/autorest/assignees{/user}","branches_url":"https://api.github.com/repos/tbombach/autorest/branches{/branch}","tags_url":"https://api.github.com/repos/tbombach/autorest/tags","blobs_url":"https://api.github.com/repos/tbombach/autorest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tbombach/autorest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tbombach/autorest/git/refs{/sha}","trees_url":"https://api.github.com/repos/tbombach/autorest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tbombach/autorest/statuses/{sha}","languages_url":"https://api.github.com/repos/tbombach/autorest/languages","stargazers_url":"https://api.github.com/repos/tbombach/autorest/stargazers","contributors_url":"https://api.github.com/repos/tbombach/autorest/contributors","subscribers_url":"https://api.github.com/repos/tbombach/autorest/subscribers","subscription_url":"https://api.github.com/repos/tbombach/autorest/subscription","commits_url":"https://api.github.com/repos/tbombach/autorest/commits{/sha}","git_commits_url":"https://api.github.com/repos/tbombach/autorest/git/commits{/sha}","comments_url":"https://api.github.com/repos/tbombach/autorest/comments{/number}","issue_comment_url":"https://api.github.com/repos/tbombach/autorest/issues/comments{/number}","contents_url":"https://api.github.com/repos/tbombach/autorest/contents/{+path}","compare_url":"https://api.github.com/repos/tbombach/autorest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tbombach/autorest/merges","archive_url":"https://api.github.com/repos/tbombach/autorest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tbombach/autorest/downloads","issues_url":"https://api.github.com/repos/tbombach/autorest/issues{/number}","pulls_url":"https://api.github.com/repos/tbombach/autorest/pulls{/number}","milestones_url":"https://api.github.com/repos/tbombach/autorest/milestones{/number}","notifications_url":"https://api.github.com/repos/tbombach/autorest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tbombach/autorest/labels{/name}","releases_url":"https://api.github.com/repos/tbombach/autorest/releases{/id}","deployments_url":"https://api.github.com/repos/tbombach/autorest/deployments","created_at":"2016-03-14T19:06:35Z","updated_at":"2016-03-14T19:06:42Z","pushed_at":"2016-08-30T23:36:52Z","git_url":"git://github.com/tbombach/autorest.git","ssh_url":"git@github.com:tbombach/autorest.git","clone_url":"https://github.com/tbombach/autorest.git","svn_url":"https://github.com/tbombach/autorest","homepage":null,"size":52790,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Azure:master","ref":"master","sha":"8d92584f79d6e656e007cd2fed4711efc82e064b","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":31089461,"name":"autorest","full_name":"Azure/autorest","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/autorest","description":"Swagger (OpenAPI) Specification code generator featuring C# and Razor templates. Supports C#, Java, Node.js, TypeScript, Python and Ruby.","fork":false,"url":"https://api.github.com/repos/Azure/autorest","forks_url":"https://api.github.com/repos/Azure/autorest/forks","keys_url":"https://api.github.com/repos/Azure/autorest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/autorest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/autorest/teams","hooks_url":"https://api.github.com/repos/Azure/autorest/hooks","issue_events_url":"https://api.github.com/repos/Azure/autorest/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/autorest/events","assignees_url":"https://api.github.com/repos/Azure/autorest/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/autorest/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/autorest/tags","blobs_url":"https://api.github.com/repos/Azure/autorest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/autorest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/autorest/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/autorest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/autorest/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/autorest/languages","stargazers_url":"https://api.github.com/repos/Azure/autorest/stargazers","contributors_url":"https://api.github.com/repos/Azure/autorest/contributors","subscribers_url":"https://api.github.com/repos/Azure/autorest/subscribers","subscription_url":"https://api.github.com/repos/Azure/autorest/subscription","commits_url":"https://api.github.com/repos/Azure/autorest/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/autorest/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/autorest/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/autorest/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/autorest/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/autorest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/autorest/merges","archive_url":"https://api.github.com/repos/Azure/autorest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/autorest/downloads","issues_url":"https://api.github.com/repos/Azure/autorest/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/autorest/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/autorest/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/autorest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/autorest/labels{/name}","releases_url":"https://api.github.com/repos/Azure/autorest/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/autorest/deployments","created_at":"2015-02-20T23:02:54Z","updated_at":"2016-08-30T05:58:04Z","pushed_at":"2016-08-30T23:44:04Z","git_url":"git://github.com/Azure/autorest.git","ssh_url":"git@github.com:Azure/autorest.git","clone_url":"https://github.com/Azure/autorest.git","svn_url":"https://github.com/Azure/autorest","homepage":"","size":57763,"stargazers_count":460,"watchers_count":460,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":159,"mirror_url":null,"open_issues_count":113,"forks":159,"open_issues":113,"watchers":460,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/autorest/pulls/1386"},"html":{"href":"https://github.com/Azure/autorest/pull/1386"},"issue":{"href":"https://api.github.com/repos/Azure/autorest/issues/1386"},"comments":{"href":"https://api.github.com/repos/Azure/autorest/issues/1386/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/autorest/pulls/1386/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/autorest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/autorest/pulls/1386/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/autorest/statuses/ae53f0f6fa511860743a03bf2c23348a80a5333d"}}}}
{"actor":{"display_login":"John-Hart"}}