{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/comments/72829756","id":72829756,"diff_hunk":"@@ -0,0 +1,134 @@\n+﻿using System;\n+using System.Threading.Tasks;\n+using Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Models;\n+using Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.Repository;\n+using Moq;\n+using Ploeh.AutoFixture;\n+using Xunit;\n+\n+namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infrastructure.UnitTests.Infrastructure\n+{\n+    public class IoTHubRepositoryTests\n+    {\n+        private readonly IIotHubRepository iotHubRepository;\n+        private readonly Mock<IDeviceManager> deviceManagerMock;\n+        private readonly Fixture fixture;\n+\n+        public IoTHubRepositoryTests()\n+        {\n+            this.deviceManagerMock = new Mock<IDeviceManager>();\n+            this.deviceManagerMock.Setup(dm => dm.AddDeviceAsync(It.IsAny<Device>())).Returns(Task.FromResult(new Device()));\n+            this.deviceManagerMock.Setup(dm => dm.RemoveDeviceAsync(It.IsAny<string>())).Returns(Task.FromResult(true));\n+            this.iotHubRepository = new IotHubRepository(this.deviceManagerMock.Object);\n+            this.fixture = new Fixture();\n+        }\n+\n+        [Fact]\n+        public async void AddDeviceAsync()\n+        {\n+            var device = this.fixture.Create<DeviceModel>();\n+            var keys = new SecurityKeys(\"fbsIV6w7gfVUyoRIQFSVgw ==\", \"1fLjiNCMZF37LmHnjZDyVQ ==\");\n+            var sameDevice = await this.iotHubRepository.AddDeviceAsync(device, keys);\n+            Assert.Equal(sameDevice, device);\n+        }\n+\n+        [Fact]\n+        public async void TryAddDeviceAsync()\n+        {\n+            var device = new Device(\"deviceId\")\n+                         {\n+                             Authentication = null,\n+                             Status = new DeviceStatus()\n+                         };\n+\n+            var result = await this.iotHubRepository.TryAddDeviceAsync(device);\n+            Assert.True(result);\n+","path":"DeviceAdministration/Infrastructure.UnitTests/Infrastructure/IoTHubRepositoryTests.cs","position":46,"original_position":46,"commit_id":"837f5d3989075ae329d544ccbad40a8ac0677024","original_commit_id":"85343f7fe46e4ad30c121c7f1cb1842956b96b61","user":{"login":"handeadiguzel","id":9712405,"avatar_url":"https://avatars.githubusercontent.com/u/9712405?v=3","gravatar_id":"","url":"https://api.github.com/users/handeadiguzel","html_url":"https://github.com/handeadiguzel","followers_url":"https://api.github.com/users/handeadiguzel/followers","following_url":"https://api.github.com/users/handeadiguzel/following{/other_user}","gists_url":"https://api.github.com/users/handeadiguzel/gists{/gist_id}","starred_url":"https://api.github.com/users/handeadiguzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/handeadiguzel/subscriptions","organizations_url":"https://api.github.com/users/handeadiguzel/orgs","repos_url":"https://api.github.com/users/handeadiguzel/repos","events_url":"https://api.github.com/users/handeadiguzel/events{/privacy}","received_events_url":"https://api.github.com/users/handeadiguzel/received_events","type":"User","site_admin":false},"body":"IoTHubRepository doesn't do any validation for device objects. We can test that scenario for a class that uses DeviceSchemaHelper and send invalid device objects. ","created_at":"2016-07-29T17:29:39Z","updated_at":"2016-07-29T17:29:39Z","html_url":"https://github.com/Azure/azure-iot-remote-monitoring/pull/303#discussion_r72829756","pull_request_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/303","_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/comments/72829756"},"html":{"href":"https://github.com/Azure/azure-iot-remote-monitoring/pull/303#discussion_r72829756"},"pull_request":{"href":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/303"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/303","id":79300169,"html_url":"https://github.com/Azure/azure-iot-remote-monitoring/pull/303","diff_url":"https://github.com/Azure/azure-iot-remote-monitoring/pull/303.diff","patch_url":"https://github.com/Azure/azure-iot-remote-monitoring/pull/303.patch","issue_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues/303","number":303,"state":"open","locked":false,"title":"Haadig moqtest","user":{"login":"handeadiguzel","id":9712405,"avatar_url":"https://avatars.githubusercontent.com/u/9712405?v=3","gravatar_id":"","url":"https://api.github.com/users/handeadiguzel","html_url":"https://github.com/handeadiguzel","followers_url":"https://api.github.com/users/handeadiguzel/followers","following_url":"https://api.github.com/users/handeadiguzel/following{/other_user}","gists_url":"https://api.github.com/users/handeadiguzel/gists{/gist_id}","starred_url":"https://api.github.com/users/handeadiguzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/handeadiguzel/subscriptions","organizations_url":"https://api.github.com/users/handeadiguzel/orgs","repos_url":"https://api.github.com/users/handeadiguzel/repos","events_url":"https://api.github.com/users/handeadiguzel/events{/privacy}","received_events_url":"https://api.github.com/users/handeadiguzel/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-29T03:01:29Z","updated_at":"2016-07-29T17:29:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb42204fa30f7f7adf0d233e0b1b35255cad3ad9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/303/commits","review_comments_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/303/comments","review_comment_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues/303/comments","statuses_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/statuses/837f5d3989075ae329d544ccbad40a8ac0677024","head":{"label":"Azure:haadig-moqtest","ref":"haadig-moqtest","sha":"837f5d3989075ae329d544ccbad40a8ac0677024","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":39550433,"name":"azure-iot-remote-monitoring","full_name":"Azure/azure-iot-remote-monitoring","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/azure-iot-remote-monitoring","description":"Azure IoT Remote Monitoring preconfigured solution","fork":false,"url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring","forks_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/forks","keys_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/teams","hooks_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/hooks","issue_events_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/events","assignees_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/tags","blobs_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/languages","stargazers_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/stargazers","contributors_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/contributors","subscribers_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/subscribers","subscription_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/subscription","commits_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/merges","archive_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/downloads","issues_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/labels{/name}","releases_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/deployments","created_at":"2015-07-23T06:43:58Z","updated_at":"2016-07-29T15:52:30Z","pushed_at":"2016-07-29T17:25:31Z","git_url":"git://github.com/Azure/azure-iot-remote-monitoring.git","ssh_url":"git@github.com:Azure/azure-iot-remote-monitoring.git","clone_url":"https://github.com/Azure/azure-iot-remote-monitoring.git","svn_url":"https://github.com/Azure/azure-iot-remote-monitoring","homepage":null,"size":9407,"stargazers_count":103,"watchers_count":103,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":110,"mirror_url":null,"open_issues_count":7,"forks":110,"open_issues":7,"watchers":103,"default_branch":"master"}},"base":{"label":"Azure:august-integration","ref":"august-integration","sha":"46753a6ae54c496ddd53595a13ee74b8abbcaca3","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":39550433,"name":"azure-iot-remote-monitoring","full_name":"Azure/azure-iot-remote-monitoring","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/azure-iot-remote-monitoring","description":"Azure IoT Remote Monitoring preconfigured solution","fork":false,"url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring","forks_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/forks","keys_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/teams","hooks_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/hooks","issue_events_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/events","assignees_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/tags","blobs_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/languages","stargazers_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/stargazers","contributors_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/contributors","subscribers_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/subscribers","subscription_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/subscription","commits_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/merges","archive_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/downloads","issues_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/labels{/name}","releases_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/deployments","created_at":"2015-07-23T06:43:58Z","updated_at":"2016-07-29T15:52:30Z","pushed_at":"2016-07-29T17:25:31Z","git_url":"git://github.com/Azure/azure-iot-remote-monitoring.git","ssh_url":"git@github.com:Azure/azure-iot-remote-monitoring.git","clone_url":"https://github.com/Azure/azure-iot-remote-monitoring.git","svn_url":"https://github.com/Azure/azure-iot-remote-monitoring","homepage":null,"size":9407,"stargazers_count":103,"watchers_count":103,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":110,"mirror_url":null,"open_issues_count":7,"forks":110,"open_issues":7,"watchers":103,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/303"},"html":{"href":"https://github.com/Azure/azure-iot-remote-monitoring/pull/303"},"issue":{"href":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues/303"},"comments":{"href":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/issues/303/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/303/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/pulls/303/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/azure-iot-remote-monitoring/statuses/837f5d3989075ae329d544ccbad40a8ac0677024"}}}}
{"actor":{"display_login":"handeadiguzel"}}