{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/63581610","id":63581610,"diff_hunk":"@@ -0,0 +1,374 @@\n+// Licensed to the .NET Foundation under one or more agreements.\n+// The .NET Foundation licenses this file to you under the MIT license.\n+// See the LICENSE file in the project root for more information.\n+\n+using Xunit;\n+using System;\n+using System.Reflection;\n+using System.Collections.Generic;\n+\n+#pragma warning disable 0414\n+\n+namespace System.Reflection.Tests\n+{\n+    public class PropertyInfoGetValueTests\n+    {\n+        public static void TestGetSet_PropertyA()\n+        {\n+            string propertyName = \"PropertyA\";\n+            MyCoVariantTest obj = new MyCoVariantTest();\n+            PropertyInfo pi = GetProperty(typeof(MyCoVariantTest), propertyName);\n+\n+            Assert.Equal(pi.Name, propertyName);\n+\n+            var value = pi.GetValue(obj);\n+\n+            Assert.NotNull(value);\n+\n+            string[] strs = new string[1];\n+            strs[0] = \"hello\";\n+\n+            //set value\n+            pi.SetValue(obj, strs);\n+            value = pi.GetValue(obj);\n+\n+            string[] strs2 = (string[])value;\n+\n+            Assert.Equal(strs2[0], strs[0]);\n+        }\n+\n+\n+        [Fact]\n+        public static void TestGetSet_PropertyB()\n+        {\n+            string propertyName = \"PropertyB\";\n+            MyCoVariantTest obj = new MyCoVariantTest();\n+            PropertyInfo pi = GetProperty(typeof(MyCoVariantTest), propertyName);\n+\n+            Assert.Equal(pi.Name, propertyName);\n+\n+            var value = pi.GetValue(obj);\n+\n+            Assert.Null(value);\n+\n+            string[] strs = new string[1];\n+            strs[0] = \"hello\";\n+\n+            //set value\n+            pi.SetValue(obj, strs);\n+            value = pi.GetValue(obj);\n+\n+            string[] strs2 = (string[])value;\n+\n+            Assert.Equal(strs2[0], strs[0]);\n+        }\n+\n+        [Fact]\n+        public static void TestGetSet_Name()\n+        {\n+            string propertyName = \"Name\";\n+            InterfacePropertyImpl obj = new InterfacePropertyImpl();\n+            PropertyInfo pi = GetProperty(typeof(InterfacePropertyImpl), propertyName);\n+\n+            Assert.Equal(pi.Name, propertyName);\n+\n+            var value = pi.GetValue(obj, (Object[])null);\n+\n+            Assert.Null(value);\n+\n+            //set value\n+            string strs1 = \"hello\";\n+\n+            pi.SetValue(obj, strs1);\n+            value = pi.GetValue(obj);\n+            string strs2 = (string)value;\n+            Assert.Equal(strs2, strs1);\n+        }\n+\n+        [Fact]\n+        public static void TestGet_PropertyC()\n+        {\n+            string propertyName = \"PropertyC\";\n+            MyCoVariantTest obj = new MyCoVariantTest();\n+            PropertyInfo pi = GetProperty(typeof(MyCoVariantTest), propertyName);\n+\n+            Assert.Equal(pi.Name, propertyName);\n+\n+            var value = pi.GetValue(obj, new Object[] { 1, \"2\" });\n+\n+            Assert.Null(value);\n+        }\n+\n+        [Fact]\n+        public static void TestGet_Property2()\n+        {\n+            string propertyName = \"Property2\";\n+            LaterClass obj = new LaterClass();\n+            PropertyInfo pi = GetProperty(typeof(LaterClass), propertyName);\n+\n+            Assert.Equal(pi.Name, propertyName);\n+\n+            int value = (int)pi.GetValue(obj);\n+\n+            Assert.Equal(value, 100);\n+        }\n+\n+        //Try to set indexer Property\n+        [Fact]\n+        public static void TestSet_Item()\n+        {\n+            string propertyName = \"Item\";\n+            TypeWithProperties obj = new TypeWithProperties();\n+            PropertyInfo pi = GetProperty(typeof(TypeWithProperties), propertyName);\n+            string[] h = { \"hello\" };\n+\n+            Assert.Equal(pi.Name, propertyName);\n+\n+            pi.SetValue(obj, \"someotherstring\", new Object[] { 99, 2, h, \"f\" });\n+\n+            Assert.Equal(\"992f1someotherstring\", obj.setValue);\n+\n+            pi.SetValue(obj, \"pw\", new Object[] { 99, 2, h, \"SOME  string\" });\n+\n+            Assert.Equal(\"992SOME  string1pw\", obj.setValue);\n+        }\n+\n+        //\n+        // Negative Tests for PropertyInfo\n+        //\n+\n+        [Theory]\n+        [InlineData(\"PropertyC\", typeof(MyCoVariantTest), new Object[] { 1, \"2\", 3 })]\n+        [InlineData(\"PropertyC\", typeof(MyCoVariantTest), null)]\n+        public static void TestGet_ThrowsTargetParameterCountException(string propertyName, Type type, Object[]testObj)\n+        {\n+            Object obj = Activator.CreateInstance(type);\n+            PropertyInfo pi = GetProperty(type, propertyName);\n+\n+            Assert.Equal(pi.Name, propertyName);\n+\n+            Assert.Throws<TargetParameterCountException>(() =>\n+            {\n+                var value = pi.GetValue(obj, testObj);\n+            });\n+        }\n+\n+        [Theory]\n+        [InlineData(\"Property1\", typeof(LaterClass), null)]\n+        [InlineData(\"PropertyC\", typeof(MyCoVariantTest), new Object[] { \"1\", \"2\" })]\n+        public static void TestGet_ThrowsArgumentException(string propertyName, Type type, Object[] testObj)\n+        {\n+            Object obj = Activator.CreateInstance(type);\n+            PropertyInfo pi = GetProperty(type, propertyName);\n+\n+            Assert.Equal(pi.Name, propertyName);\n+\n+            Assert.Throws<ArgumentException>(() =>\n+            {\n+                var value = pi.GetValue(obj, testObj);\n+            });\n+        }\n+\n+\n+        //Verify PropertyInfo.GetValue throws Exception\n+        [Fact]\n+        public static void TestGet_ThrowsException()\n+        {\n+            string propertyName = \"PropertyC\";\n+            Object obj = Activator.CreateInstance(typeof(MyCoVariantTest));","path":"src/System.Reflection/tests/PropertyInfo/PropertyInfo_GetSetValueTests.cs","position":178,"original_position":178,"commit_id":"044d211da72950936fc831c091b717e6a6a473de","original_commit_id":"044d211da72950936fc831c091b717e6a6a473de","user":{"login":"stephentoub","id":2642209,"avatar_url":"https://avatars.githubusercontent.com/u/2642209?v=3","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"body":"Nit: As long as we're refactoring these tests, it'd be nice to switch to the guidelines we have for the repo, which state that when there's a C# keyword that maps to a type, prefer the C# keyword, e.g. ```object``` instead of ```Object```, ```string``` instead of ```String```, ```int``` instead of ```Int32```, etc.","created_at":"2016-05-17T18:51:01Z","updated_at":"2016-05-17T18:51:01Z","html_url":"https://github.com/dotnet/corefx/pull/8609#discussion_r63581610","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/8609","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/63581610"},"html":{"href":"https://github.com/dotnet/corefx/pull/8609#discussion_r63581610"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/8609"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/8609","id":70397239,"html_url":"https://github.com/dotnet/corefx/pull/8609","diff_url":"https://github.com/dotnet/corefx/pull/8609.diff","patch_url":"https://github.com/dotnet/corefx/pull/8609.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/8609","number":8609,"state":"open","locked":false,"title":"PropertyInfo tests refactoring","user":{"login":"ioanacrant","id":8014346,"avatar_url":"https://avatars.githubusercontent.com/u/8014346?v=3","gravatar_id":"","url":"https://api.github.com/users/ioanacrant","html_url":"https://github.com/ioanacrant","followers_url":"https://api.github.com/users/ioanacrant/followers","following_url":"https://api.github.com/users/ioanacrant/following{/other_user}","gists_url":"https://api.github.com/users/ioanacrant/gists{/gist_id}","starred_url":"https://api.github.com/users/ioanacrant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ioanacrant/subscriptions","organizations_url":"https://api.github.com/users/ioanacrant/orgs","repos_url":"https://api.github.com/users/ioanacrant/repos","events_url":"https://api.github.com/users/ioanacrant/events{/privacy}","received_events_url":"https://api.github.com/users/ioanacrant/received_events","type":"User","site_admin":false},"body":"- Leveraged `Theory`\r\n- More descriptive method names\r\n- Merged GetValueTests and SetValueTests\r\n\r\n@ellismg @stephentoub @hughbe","created_at":"2016-05-17T17:27:14Z","updated_at":"2016-05-17T18:51:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f9cb35b44ae7dd194b39eebc92ac87ac9c57645c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/8609/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/8609/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/8609/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/044d211da72950936fc831c091b717e6a6a473de","head":{"label":"ioanacrant:propertyinfo-tests-refactor","ref":"propertyinfo-tests-refactor","sha":"044d211da72950936fc831c091b717e6a6a473de","user":{"login":"ioanacrant","id":8014346,"avatar_url":"https://avatars.githubusercontent.com/u/8014346?v=3","gravatar_id":"","url":"https://api.github.com/users/ioanacrant","html_url":"https://github.com/ioanacrant","followers_url":"https://api.github.com/users/ioanacrant/followers","following_url":"https://api.github.com/users/ioanacrant/following{/other_user}","gists_url":"https://api.github.com/users/ioanacrant/gists{/gist_id}","starred_url":"https://api.github.com/users/ioanacrant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ioanacrant/subscriptions","organizations_url":"https://api.github.com/users/ioanacrant/orgs","repos_url":"https://api.github.com/users/ioanacrant/repos","events_url":"https://api.github.com/users/ioanacrant/events{/privacy}","received_events_url":"https://api.github.com/users/ioanacrant/received_events","type":"User","site_admin":false},"repo":{"id":58956510,"name":"corefx","full_name":"ioanacrant/corefx","owner":{"login":"ioanacrant","id":8014346,"avatar_url":"https://avatars.githubusercontent.com/u/8014346?v=3","gravatar_id":"","url":"https://api.github.com/users/ioanacrant","html_url":"https://github.com/ioanacrant","followers_url":"https://api.github.com/users/ioanacrant/followers","following_url":"https://api.github.com/users/ioanacrant/following{/other_user}","gists_url":"https://api.github.com/users/ioanacrant/gists{/gist_id}","starred_url":"https://api.github.com/users/ioanacrant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ioanacrant/subscriptions","organizations_url":"https://api.github.com/users/ioanacrant/orgs","repos_url":"https://api.github.com/users/ioanacrant/repos","events_url":"https://api.github.com/users/ioanacrant/events{/privacy}","received_events_url":"https://api.github.com/users/ioanacrant/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ioanacrant/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":true,"url":"https://api.github.com/repos/ioanacrant/corefx","forks_url":"https://api.github.com/repos/ioanacrant/corefx/forks","keys_url":"https://api.github.com/repos/ioanacrant/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ioanacrant/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ioanacrant/corefx/teams","hooks_url":"https://api.github.com/repos/ioanacrant/corefx/hooks","issue_events_url":"https://api.github.com/repos/ioanacrant/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/ioanacrant/corefx/events","assignees_url":"https://api.github.com/repos/ioanacrant/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/ioanacrant/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/ioanacrant/corefx/tags","blobs_url":"https://api.github.com/repos/ioanacrant/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ioanacrant/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ioanacrant/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/ioanacrant/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ioanacrant/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/ioanacrant/corefx/languages","stargazers_url":"https://api.github.com/repos/ioanacrant/corefx/stargazers","contributors_url":"https://api.github.com/repos/ioanacrant/corefx/contributors","subscribers_url":"https://api.github.com/repos/ioanacrant/corefx/subscribers","subscription_url":"https://api.github.com/repos/ioanacrant/corefx/subscription","commits_url":"https://api.github.com/repos/ioanacrant/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/ioanacrant/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/ioanacrant/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/ioanacrant/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/ioanacrant/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/ioanacrant/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ioanacrant/corefx/merges","archive_url":"https://api.github.com/repos/ioanacrant/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ioanacrant/corefx/downloads","issues_url":"https://api.github.com/repos/ioanacrant/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/ioanacrant/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/ioanacrant/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/ioanacrant/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ioanacrant/corefx/labels{/name}","releases_url":"https://api.github.com/repos/ioanacrant/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/ioanacrant/corefx/deployments","created_at":"2016-05-16T18:25:31Z","updated_at":"2016-05-16T18:25:57Z","pushed_at":"2016-05-16T22:45:16Z","git_url":"git://github.com/ioanacrant/corefx.git","ssh_url":"git@github.com:ioanacrant/corefx.git","clone_url":"https://github.com/ioanacrant/corefx.git","svn_url":"https://github.com/ioanacrant/corefx","homepage":"http://dotnet.github.io/","size":69960,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"dotnet:master","ref":"master","sha":"b1651306114d352dd5d87317a975ef5194466e5d","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":26295345,"name":"corefx","full_name":"dotnet/corefx","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/corefx/deployments","created_at":"2014-11-06T23:42:48Z","updated_at":"2016-05-17T18:42:17Z","pushed_at":"2016-05-17T18:39:52Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"http://dotnet.github.io/","size":94154,"stargazers_count":9693,"watchers_count":9693,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2325,"mirror_url":null,"open_issues_count":973,"forks":2325,"open_issues":973,"watchers":9693,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/8609"},"html":{"href":"https://github.com/dotnet/corefx/pull/8609"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/8609"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/8609/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/8609/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/8609/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/044d211da72950936fc831c091b717e6a6a473de"}}}}