{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/34595562","id":34595562,"diff_hunk":"@@ -0,0 +1,106 @@\n+﻿// Copyright (c) .NET Foundation. All rights reserved.\n+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n+\n+using Microsoft.Framework.Localization;\n+using Microsoft.Framework.WebEncoders.Testing;\n+using Moq;\n+using System;\n+using System.Collections.Generic;\n+using Xunit;\n+\n+namespace Microsoft.AspNet.Mvc.Localization.Test\n+{\n+    public class HtmlLocalizerTest\n+    {\n+        [Fact]\n+        public void HtmlLocalizer_UseIndexer_ReturnsLocalizedString()\n+        {\n+            // Arrange\n+            var localizedString = new LocalizedString(\"Hello\", \"Bonjour\");\n+            var stringLocalizer = new Mock<IStringLocalizer>();\n+            stringLocalizer.Setup(s => s[\"Hello\"]).Returns(localizedString);\n+\n+            var htmlLocalizer = new HtmlLocalizer(stringLocalizer.Object, new CommonTestEncoder());\n+\n+            // Act\n+            var actualLocalizedString = htmlLocalizer[\"Hello\"];\n+\n+            // Assert\n+            Assert.Equal(localizedString, actualLocalizedString);\n+        }\n+\n+        [Fact]\n+        public void HtmlLocalizer_UseIndexerWithArguments_ReturnsLocalizedString()\n+        {\n+            // Arrange\n+            var localizedString = new LocalizedString(\"Hello\", \"Bonjour test\");\n+\n+            var stringLocalizer = new Mock<IStringLocalizer>();\n+            stringLocalizer.Setup(s => s[\"Hello\", \"test\"]).Returns(localizedString);\n+\n+            var htmlLocalizer = new HtmlLocalizer(stringLocalizer.Object, new CommonTestEncoder());\n+\n+            // Act\n+            var actualLocalizedString = htmlLocalizer[\"Hello\", \"test\"];\n+\n+            // Assert\n+            Assert.Equal(localizedString, actualLocalizedString);\n+        }\n+\n+        public static IEnumerable<object[]> HtmlData\n+        {\n+            get\n+            {\n+                yield return new object[] { \"Bonjour {0} {{{{ }}\", new object[] { \"test\" }, \"Bonjour HtmlEncode[[test]] {{ }\" };\n+                yield return new object[] { \"Bonjour {{0}}\", new object[] { \"{0}\" }, \"Bonjour {0}\" };\n+                yield return new object[] { \"Bonjour {0:x}\", new object[] { 10 }, \"Bonjour HtmlEncode[[a]]\" };\n+                yield return new object[] { \"Bonjour {0:x}}}\", new object[] { 10 }, \"Bonjour HtmlEncode[[x}]]\" };\n+                yield return new object[] { \"Bonjour {{0:x}}\", new object[] { 10 }, \"Bonjour {0:x}\" };\n+                yield return new object[] { \"{{ Bonjour {{{0:x}}}\", new object[] { 10 }, \"{ Bonjour {x}\" };\n+                yield return new object[] {\n+                    \"Bonjour {{{0:x}}} {1:yyyy}\",\n+                    new object[] { 10, new DateTime(2015, 10, 10) },\n+                    \"Bonjour {x} HtmlEncode[[2015]]\"\n+                };\n+                yield return new object[] {\n+                    \"Bonjour {{{0:x}}} Bienvenue {{1:yyyy}}\",\n+                    new object[] { 10, new DateTime(2015, 10, 10) },\n+                    \"Bonjour {x} Bienvenue {1:yyyy}\"\n+                };\n+                yield return new object[] {\n+                    \"Bonjour {0,6} Bienvenue {{1:yyyy}}\",\n+                    new object[] { 10, new DateTime(2015, 10, 10) },\n+                    \"Bonjour HtmlEncode[[    10]] Bienvenue {1:yyyy}\"\n+                };","path":"test/Microsoft.AspNet.Mvc.Localization.Test/HtmlLocalizerTest.cs","position":74,"original_position":74,"commit_id":"fd42a22d11b35bb8503b76c6d538b9919edc8418","original_commit_id":"fd42a22d11b35bb8503b76c6d538b9919edc8418","user":{"login":"dougbu","id":6431421,"avatar_url":"https://avatars.githubusercontent.com/u/6431421?v=3","gravatar_id":"","url":"https://api.github.com/users/dougbu","html_url":"https://github.com/dougbu","followers_url":"https://api.github.com/users/dougbu/followers","following_url":"https://api.github.com/users/dougbu/following{/other_user}","gists_url":"https://api.github.com/users/dougbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dougbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougbu/subscriptions","organizations_url":"https://api.github.com/users/dougbu/orgs","repos_url":"https://api.github.com/users/dougbu/repos","events_url":"https://api.github.com/users/dougbu/events{/privacy}","received_events_url":"https://api.github.com/users/dougbu/received_events","type":"User","site_admin":false},"body":"Extend this data to cover cases where \"}}\" appears _before_ the first \"{\" or \"{{\". Also test without \"Bonjour \" and with \" Bonjour\" after the last \"}\".","created_at":"2015-07-14T17:34:47Z","updated_at":"2015-07-14T17:34:47Z","html_url":"https://github.com/aspnet/Mvc/pull/2701#discussion_r34595562","pull_request_url":"https://api.github.com/repos/aspnet/Mvc/pulls/2701","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/comments/34595562"},"html":{"href":"https://github.com/aspnet/Mvc/pull/2701#discussion_r34595562"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/2701"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Mvc/pulls/2701","id":37714081,"html_url":"https://github.com/aspnet/Mvc/pull/2701","diff_url":"https://github.com/aspnet/Mvc/pull/2701.diff","patch_url":"https://github.com/aspnet/Mvc/pull/2701.patch","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/2701","number":2701,"state":"open","locked":false,"title":"Added Mvc localization package to MVC ","user":{"login":"kirthik","id":1267650,"avatar_url":"https://avatars.githubusercontent.com/u/1267650?v=3","gravatar_id":"","url":"https://api.github.com/users/kirthik","html_url":"https://github.com/kirthik","followers_url":"https://api.github.com/users/kirthik/followers","following_url":"https://api.github.com/users/kirthik/following{/other_user}","gists_url":"https://api.github.com/users/kirthik/gists{/gist_id}","starred_url":"https://api.github.com/users/kirthik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirthik/subscriptions","organizations_url":"https://api.github.com/users/kirthik/orgs","repos_url":"https://api.github.com/users/kirthik/repos","events_url":"https://api.github.com/users/kirthik/events{/privacy}","received_events_url":"https://api.github.com/users/kirthik/received_events","type":"User","site_admin":false},"body":"cc @DamianEdwards, @Eilon, @rynowak ","created_at":"2015-06-15T17:12:27Z","updated_at":"2015-07-14T17:34:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aa1818945225ccd3ccb913ba88b1f7e078e3d3a4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Mvc/pulls/2701/commits","review_comments_url":"https://api.github.com/repos/aspnet/Mvc/pulls/2701/comments","review_comment_url":"https://api.github.com/repos/aspnet/Mvc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/2701/comments","statuses_url":"https://api.github.com/repos/aspnet/Mvc/statuses/fd42a22d11b35bb8503b76c6d538b9919edc8418","head":{"label":"aspnet:localization","ref":"localization","sha":"fd42a22d11b35bb8503b76c6d538b9919edc8418","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15126429,"name":"Mvc","full_name":"aspnet/Mvc","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Mvc","description":"Model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor.","fork":false,"url":"https://api.github.com/repos/aspnet/Mvc","forks_url":"https://api.github.com/repos/aspnet/Mvc/forks","keys_url":"https://api.github.com/repos/aspnet/Mvc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Mvc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Mvc/teams","hooks_url":"https://api.github.com/repos/aspnet/Mvc/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Mvc/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Mvc/events","assignees_url":"https://api.github.com/repos/aspnet/Mvc/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Mvc/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Mvc/tags","blobs_url":"https://api.github.com/repos/aspnet/Mvc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Mvc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Mvc/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Mvc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Mvc/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Mvc/languages","stargazers_url":"https://api.github.com/repos/aspnet/Mvc/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Mvc/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Mvc/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Mvc/subscription","commits_url":"https://api.github.com/repos/aspnet/Mvc/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Mvc/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Mvc/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Mvc/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Mvc/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Mvc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Mvc/merges","archive_url":"https://api.github.com/repos/aspnet/Mvc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Mvc/downloads","issues_url":"https://api.github.com/repos/aspnet/Mvc/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Mvc/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Mvc/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Mvc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Mvc/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Mvc/releases{/id}","created_at":"2013-12-12T03:54:00Z","updated_at":"2015-07-14T07:04:14Z","pushed_at":"2015-07-14T12:03:30Z","git_url":"git://github.com/aspnet/Mvc.git","ssh_url":"git@github.com:aspnet/Mvc.git","clone_url":"https://github.com/aspnet/Mvc.git","svn_url":"https://github.com/aspnet/Mvc","homepage":"","size":126442,"stargazers_count":1956,"watchers_count":1956,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":682,"mirror_url":null,"open_issues_count":217,"forks":682,"open_issues":217,"watchers":1956,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"52af452a08b0bdbeb361b337a088d2831c505f10","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15126429,"name":"Mvc","full_name":"aspnet/Mvc","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Mvc","description":"Model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor.","fork":false,"url":"https://api.github.com/repos/aspnet/Mvc","forks_url":"https://api.github.com/repos/aspnet/Mvc/forks","keys_url":"https://api.github.com/repos/aspnet/Mvc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Mvc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Mvc/teams","hooks_url":"https://api.github.com/repos/aspnet/Mvc/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Mvc/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Mvc/events","assignees_url":"https://api.github.com/repos/aspnet/Mvc/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Mvc/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Mvc/tags","blobs_url":"https://api.github.com/repos/aspnet/Mvc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Mvc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Mvc/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Mvc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Mvc/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Mvc/languages","stargazers_url":"https://api.github.com/repos/aspnet/Mvc/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Mvc/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Mvc/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Mvc/subscription","commits_url":"https://api.github.com/repos/aspnet/Mvc/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Mvc/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Mvc/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Mvc/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Mvc/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Mvc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Mvc/merges","archive_url":"https://api.github.com/repos/aspnet/Mvc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Mvc/downloads","issues_url":"https://api.github.com/repos/aspnet/Mvc/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Mvc/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Mvc/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Mvc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Mvc/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Mvc/releases{/id}","created_at":"2013-12-12T03:54:00Z","updated_at":"2015-07-14T07:04:14Z","pushed_at":"2015-07-14T12:03:30Z","git_url":"git://github.com/aspnet/Mvc.git","ssh_url":"git@github.com:aspnet/Mvc.git","clone_url":"https://github.com/aspnet/Mvc.git","svn_url":"https://github.com/aspnet/Mvc","homepage":"","size":126442,"stargazers_count":1956,"watchers_count":1956,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":682,"mirror_url":null,"open_issues_count":217,"forks":682,"open_issues":217,"watchers":1956,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/2701"},"html":{"href":"https://github.com/aspnet/Mvc/pull/2701"},"issue":{"href":"https://api.github.com/repos/aspnet/Mvc/issues/2701"},"comments":{"href":"https://api.github.com/repos/aspnet/Mvc/issues/2701/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/2701/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Mvc/pulls/2701/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Mvc/statuses/fd42a22d11b35bb8503b76c6d538b9919edc8418"}}}}