{"action":"created","comment":{"url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/comments/41804617","id":41804617,"diff_hunk":"@@ -0,0 +1,98 @@\n+﻿using System;\n+using NUnit.Framework;\n+using System.Collections.Generic;\n+using Google.Apis.Calendar.v3.Data;\n+using BookingRoom.Models.GoogleCalendar;\n+using Google.Apis.Calendar.v3;\n+using System.Linq;\n+using BookingRoom.Helpers;\n+\n+namespace NUnitTestProject\n+{\n+    [TestFixture]\n+    public partial class BookingServiceTests : BaseIntegrationTest\n+    {\n+        [Test]\n+        public void BookingService_UpdateEvent_UpdatesEventCorrectly()\n+        {\n+            var calendarId = AppSettingsHelper.GetAppSetting(AppSetingsConst.TestCalendar);\n+\n+            var beforeUpdateEventList = _calendarService.Events.List(calendarId).Execute().Items;\n+            if (beforeUpdateEventList == null)\n+                throw new Exception(\"Event list are empty!\");\n+            var testEvent = beforeUpdateEventList[0];\n+\n+            var currentSummary = testEvent.Summary; //remember current state\n+            var currentDesctiption = testEvent.Description;\n+            testEvent.Summary = \"ChangedSummary\"; //chenage event\n+            testEvent.Description = \"ChengedDescription\";\n+\n+            _meetingBooking.UpdateEvent(testEvent, calendarId, testEvent.Id);\n+\n+            var ufterApdateList = _calendarService.Events.List(calendarId).Execute().Items;\n+\n+            var testedAfterUpdateEvent = (from gEvent in ufterApdateList\n+                                          where gEvent.Id == testEvent.Id\n+                                          select gEvent).First();\n+            if (testedAfterUpdateEvent == null)\n+                throw new Exception(\"Cant Find updated Event\");\n+\n+            Assert.AreEqual(testEvent.Summary, testedAfterUpdateEvent.Summary); //we cant just Assert.AreEqual(two this object) couse of \"updated\" time field will be different anyway\n+            Assert.AreEqual(testEvent.Description, testedAfterUpdateEvent.Description);\n+\n+            testedAfterUpdateEvent.Summary = currentSummary;//push event back to past state\n+            testedAfterUpdateEvent.Description = currentDesctiption;\n+\n+            _meetingBooking.UpdateEvent(testedAfterUpdateEvent, calendarId, testedAfterUpdateEvent.Id);\n+\n+            var checkBackEvent = (from gEvent in beforeUpdateEventList\n+                                  where gEvent.Id == testEvent.Id\n+                                  select gEvent).Single();\n+            if (checkBackEvent == null)\n+                throw new Exception(\"Cant Find updated Event\");\n+\n+            Assert.AreEqual(checkBackEvent.Summary, testEvent.Summary);\n+            Assert.AreEqual(checkBackEvent.Description, testEvent.Description);\n+        }\n+\n+        [Test]\n+        public void BookingService_UpdateEvent_WrongCalendarIdThrowException()\n+        {\n+            var calendarId = AppSettingsHelper.GetAppSetting(AppSetingsConst.TestCalendar);\n+\n+            var beforeUpdateEventList = _calendarService.Events.List(calendarId).Execute().Items;\n+            if (beforeUpdateEventList == null)\n+                throw new Exception(\"Empty event list\");\n+            var testEvent = beforeUpdateEventList[0];//take any event\n+\n+            Assert.Throws(typeof(Google.GoogleApiException),\n+                () => { _meetingBooking.UpdateEvent(testEvent, string.Empty, testEvent.Id); });\n+        }\n+\n+        [Test]\n+        public void BookingService_UpdateEvent_WrongEventIdThrowException()\n+        {\n+            var calendarId = AppSettingsHelper.GetAppSetting(AppSetingsConst.TestCalendar);\n+\n+            var beforeUpdateEventList = _calendarService.Events.List(calendarId).Execute().Items;\n+            if (beforeUpdateEventList == null)\n+                throw new Exception(\"Empty event list\");","path":"CalendarApp/NUnitTestProject/BookingServiceTests.UpdateTest.cs","position":79,"original_position":79,"commit_id":"a8d26c49e504be58c5647b216a1db57fcf5619f5","original_commit_id":"a8d26c49e504be58c5647b216a1db57fcf5619f5","user":{"login":"gregory-hasyn","id":6704557,"avatar_url":"https://avatars.githubusercontent.com/u/6704557?v=3","gravatar_id":"","url":"https://api.github.com/users/gregory-hasyn","html_url":"https://github.com/gregory-hasyn","followers_url":"https://api.github.com/users/gregory-hasyn/followers","following_url":"https://api.github.com/users/gregory-hasyn/following{/other_user}","gists_url":"https://api.github.com/users/gregory-hasyn/gists{/gist_id}","starred_url":"https://api.github.com/users/gregory-hasyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregory-hasyn/subscriptions","organizations_url":"https://api.github.com/users/gregory-hasyn/orgs","repos_url":"https://api.github.com/users/gregory-hasyn/repos","events_url":"https://api.github.com/users/gregory-hasyn/events{/privacy}","received_events_url":"https://api.github.com/users/gregory-hasyn/received_events","type":"User","site_admin":false},"body":"Still curiously why has exception been thrown here (and in another occurred places)?","created_at":"2015-10-12T21:42:42Z","updated_at":"2015-10-12T21:42:42Z","html_url":"https://github.com/OrestHurskiy/CalenderApp/pull/9#discussion_r41804617","pull_request_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/comments/41804617"},"html":{"href":"https://github.com/OrestHurskiy/CalenderApp/pull/9#discussion_r41804617"},"pull_request":{"href":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/9","id":47034648,"html_url":"https://github.com/OrestHurskiy/CalenderApp/pull/9","diff_url":"https://github.com/OrestHurskiy/CalenderApp/pull/9.diff","patch_url":"https://github.com/OrestHurskiy/CalenderApp/pull/9.patch","issue_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues/9","number":9,"state":"open","locked":false,"title":"Creating NUnit Test Project","user":{"login":"OrestHurskiy","id":11854706,"avatar_url":"https://avatars.githubusercontent.com/u/11854706?v=3","gravatar_id":"","url":"https://api.github.com/users/OrestHurskiy","html_url":"https://github.com/OrestHurskiy","followers_url":"https://api.github.com/users/OrestHurskiy/followers","following_url":"https://api.github.com/users/OrestHurskiy/following{/other_user}","gists_url":"https://api.github.com/users/OrestHurskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/OrestHurskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OrestHurskiy/subscriptions","organizations_url":"https://api.github.com/users/OrestHurskiy/orgs","repos_url":"https://api.github.com/users/OrestHurskiy/repos","events_url":"https://api.github.com/users/OrestHurskiy/events{/privacy}","received_events_url":"https://api.github.com/users/OrestHurskiy/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-07T14:31:06Z","updated_at":"2015-10-12T21:42:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"31cdf7a936c048b2f002c35d6b28f36ba9827ca2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/9/commits","review_comments_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/9/comments","review_comment_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues/9/comments","statuses_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/statuses/a8d26c49e504be58c5647b216a1db57fcf5619f5","head":{"label":"OrestHurskiy:UnitTestProject","ref":"UnitTestProject","sha":"a8d26c49e504be58c5647b216a1db57fcf5619f5","user":{"login":"OrestHurskiy","id":11854706,"avatar_url":"https://avatars.githubusercontent.com/u/11854706?v=3","gravatar_id":"","url":"https://api.github.com/users/OrestHurskiy","html_url":"https://github.com/OrestHurskiy","followers_url":"https://api.github.com/users/OrestHurskiy/followers","following_url":"https://api.github.com/users/OrestHurskiy/following{/other_user}","gists_url":"https://api.github.com/users/OrestHurskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/OrestHurskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OrestHurskiy/subscriptions","organizations_url":"https://api.github.com/users/OrestHurskiy/orgs","repos_url":"https://api.github.com/users/OrestHurskiy/repos","events_url":"https://api.github.com/users/OrestHurskiy/events{/privacy}","received_events_url":"https://api.github.com/users/OrestHurskiy/received_events","type":"User","site_admin":false},"repo":{"id":42934225,"name":"CalenderApp","full_name":"OrestHurskiy/CalenderApp","owner":{"login":"OrestHurskiy","id":11854706,"avatar_url":"https://avatars.githubusercontent.com/u/11854706?v=3","gravatar_id":"","url":"https://api.github.com/users/OrestHurskiy","html_url":"https://github.com/OrestHurskiy","followers_url":"https://api.github.com/users/OrestHurskiy/followers","following_url":"https://api.github.com/users/OrestHurskiy/following{/other_user}","gists_url":"https://api.github.com/users/OrestHurskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/OrestHurskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OrestHurskiy/subscriptions","organizations_url":"https://api.github.com/users/OrestHurskiy/orgs","repos_url":"https://api.github.com/users/OrestHurskiy/repos","events_url":"https://api.github.com/users/OrestHurskiy/events{/privacy}","received_events_url":"https://api.github.com/users/OrestHurskiy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/OrestHurskiy/CalenderApp","description":"Booking meeting rooms","fork":false,"url":"https://api.github.com/repos/OrestHurskiy/CalenderApp","forks_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/forks","keys_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/teams","hooks_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/hooks","issue_events_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues/events{/number}","events_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/events","assignees_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/assignees{/user}","branches_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/branches{/branch}","tags_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/tags","blobs_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/refs{/sha}","trees_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/statuses/{sha}","languages_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/languages","stargazers_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/stargazers","contributors_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/contributors","subscribers_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/subscribers","subscription_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/subscription","commits_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/commits{/sha}","git_commits_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/commits{/sha}","comments_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/comments{/number}","issue_comment_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues/comments{/number}","contents_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/contents/{+path}","compare_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/merges","archive_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/downloads","issues_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues{/number}","pulls_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls{/number}","milestones_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/milestones{/number}","notifications_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/labels{/name}","releases_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/releases{/id}","created_at":"2015-09-22T13:06:53Z","updated_at":"2015-09-25T07:43:48Z","pushed_at":"2015-10-12T18:47:30Z","git_url":"git://github.com/OrestHurskiy/CalenderApp.git","ssh_url":"git@github.com:OrestHurskiy/CalenderApp.git","clone_url":"https://github.com/OrestHurskiy/CalenderApp.git","svn_url":"https://github.com/OrestHurskiy/CalenderApp","homepage":null,"size":12904,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"OrestHurskiy:dev","ref":"dev","sha":"2eaf24276f4754648264d1055fc8ce8a3a538c38","user":{"login":"OrestHurskiy","id":11854706,"avatar_url":"https://avatars.githubusercontent.com/u/11854706?v=3","gravatar_id":"","url":"https://api.github.com/users/OrestHurskiy","html_url":"https://github.com/OrestHurskiy","followers_url":"https://api.github.com/users/OrestHurskiy/followers","following_url":"https://api.github.com/users/OrestHurskiy/following{/other_user}","gists_url":"https://api.github.com/users/OrestHurskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/OrestHurskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OrestHurskiy/subscriptions","organizations_url":"https://api.github.com/users/OrestHurskiy/orgs","repos_url":"https://api.github.com/users/OrestHurskiy/repos","events_url":"https://api.github.com/users/OrestHurskiy/events{/privacy}","received_events_url":"https://api.github.com/users/OrestHurskiy/received_events","type":"User","site_admin":false},"repo":{"id":42934225,"name":"CalenderApp","full_name":"OrestHurskiy/CalenderApp","owner":{"login":"OrestHurskiy","id":11854706,"avatar_url":"https://avatars.githubusercontent.com/u/11854706?v=3","gravatar_id":"","url":"https://api.github.com/users/OrestHurskiy","html_url":"https://github.com/OrestHurskiy","followers_url":"https://api.github.com/users/OrestHurskiy/followers","following_url":"https://api.github.com/users/OrestHurskiy/following{/other_user}","gists_url":"https://api.github.com/users/OrestHurskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/OrestHurskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OrestHurskiy/subscriptions","organizations_url":"https://api.github.com/users/OrestHurskiy/orgs","repos_url":"https://api.github.com/users/OrestHurskiy/repos","events_url":"https://api.github.com/users/OrestHurskiy/events{/privacy}","received_events_url":"https://api.github.com/users/OrestHurskiy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/OrestHurskiy/CalenderApp","description":"Booking meeting rooms","fork":false,"url":"https://api.github.com/repos/OrestHurskiy/CalenderApp","forks_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/forks","keys_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/teams","hooks_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/hooks","issue_events_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues/events{/number}","events_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/events","assignees_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/assignees{/user}","branches_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/branches{/branch}","tags_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/tags","blobs_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/refs{/sha}","trees_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/statuses/{sha}","languages_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/languages","stargazers_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/stargazers","contributors_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/contributors","subscribers_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/subscribers","subscription_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/subscription","commits_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/commits{/sha}","git_commits_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/git/commits{/sha}","comments_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/comments{/number}","issue_comment_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues/comments{/number}","contents_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/contents/{+path}","compare_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/merges","archive_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/downloads","issues_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues{/number}","pulls_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls{/number}","milestones_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/milestones{/number}","notifications_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/labels{/name}","releases_url":"https://api.github.com/repos/OrestHurskiy/CalenderApp/releases{/id}","created_at":"2015-09-22T13:06:53Z","updated_at":"2015-09-25T07:43:48Z","pushed_at":"2015-10-12T18:47:30Z","git_url":"git://github.com/OrestHurskiy/CalenderApp.git","ssh_url":"git@github.com:OrestHurskiy/CalenderApp.git","clone_url":"https://github.com/OrestHurskiy/CalenderApp.git","svn_url":"https://github.com/OrestHurskiy/CalenderApp","homepage":null,"size":12904,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/9"},"html":{"href":"https://github.com/OrestHurskiy/CalenderApp/pull/9"},"issue":{"href":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues/9"},"comments":{"href":"https://api.github.com/repos/OrestHurskiy/CalenderApp/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OrestHurskiy/CalenderApp/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/OrestHurskiy/CalenderApp/statuses/a8d26c49e504be58c5647b216a1db57fcf5619f5"}}}}