{"action":"created","comment":{"url":"https://api.github.com/repos/Saylala/tdd/pulls/comments/85175519","pull_request_review_id":5902768,"id":85175519,"diff_hunk":"@@ -0,0 +1,124 @@\n+﻿using System;\n+using System.Linq;\n+using System.Drawing;\n+using System.IO;\n+using NUnit.Framework;\n+using NUnit.Framework.Interfaces;\n+\n+namespace TagsCloudVisualization\n+{\n+    [TestFixture]\n+    class CircularCloudLayouterTests\n+    {\n+        private readonly Point center = new Point(500, 500);\n+        private CircularCloudLayouter cloudLayouter;\n+\n+        [SetUp]\n+        public void SetUp()\n+        {\n+            cloudLayouter = new CircularCloudLayouter(center);\n+        }\n+\n+        [TearDown]\n+        public void TearDown()\n+        {\n+            if (!Equals(TestContext.CurrentContext.Result.Outcome, ResultState.Failure))\n+                return;\n+            var visualiser = new CloudVisualizer();\n+            var data = cloudLayouter.GetRectangles();\n+            var name = TestContext.CurrentContext.Test.Name + \".png\";\n+            var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, name);\n+            visualiser.Visualise(data, path);\n+            Console.WriteLine($\"Tag cloud visualization saved to file {name}\");\n+        }\n+\n+        [TestCase(10, 10, ExpectedResult = true)]\n+        [TestCase(100, 50, ExpectedResult = true)]\n+        [TestCase(20, 30, ExpectedResult = true)]\n+        [TestCase(1000, 2000, ExpectedResult = true)]\n+        [TestCase(500, 600, ExpectedResult = true)]\n+        public bool FirstRectangle_PlacedInsideCloud_IsPlacedInCenter(int width, int height)\n+        {\n+            var rectangleSize = new Size(width, height);\n+\n+            var resultedRectangle = cloudLayouter.PutNextRectangle(rectangleSize);\n+\n+            return resultedRectangle.GetCenter().Equals(center);\n+        }\n+\n+        [TestCase(12, 11, ExpectedResult = false)]\n+        [TestCase(130, 18, ExpectedResult = false)]\n+        [TestCase(27, 38, ExpectedResult = false)]\n+        [TestCase(5000, 1, ExpectedResult = false)]\n+        [TestCase(4800, 600, ExpectedResult = false)]\n+        public bool TwoRectanlges_PlacedInsideCloud_DoNotIntersect(int width, int height)\n+        {\n+            var rectangleSize = new Size(width, height);\n+\n+            var firstRectangle = cloudLayouter.PutNextRectangle(rectangleSize);\n+            var secondRectangle = cloudLayouter.PutNextRectangle(rectangleSize);\n+\n+            return firstRectangle.IntersectsWith(secondRectangle);\n+        }\n+\n+        [TestCase(5, 4, ExpectedResult = false)]\n+        [TestCase(125, 75, ExpectedResult = false)]\n+        [TestCase(20, 40, ExpectedResult = false)]\n+        [TestCase(1200, 1800, ExpectedResult = false)]\n+        [TestCase(400, 750, ExpectedResult = false)]\n+        public bool TwoRectangles_PlacedInsideCloud_DoNotHaveSameCenters(int width, int height)\n+        {\n+            var rectangleSize = new Size(width, height);\n+\n+            var firstRectangle = cloudLayouter.PutNextRectangle(rectangleSize);\n+            var secondRectangle = cloudLayouter.PutNextRectangle(rectangleSize);\n+\n+            return firstRectangle.GetCenter().Equals(secondRectangle.GetCenter());\n+        }\n+\n+        [TestCase(100, 10, 10, ExpectedResult = false)]\n+        [TestCase(2, 50, 5, ExpectedResult = false)]\n+        [TestCase(70, 30, 12, ExpectedResult = false)]\n+        [TestCase(1000, 200, 25, ExpectedResult = false)]\n+        [TestCase(899, 100, 100, ExpectedResult = false)]\n+        public bool NewRectangle_PlacedInsideCloud_DoesNotIntersectWithOthers(int width, int height, int count)\n+        {\n+            var rectangleSize = new Size(width, height);\n+\n+            if (count == 0)\n+                return false;\n+            for (var i = 0; i < count; i++)\n+                cloudLayouter.PutNextRectangle(rectangleSize);\n+            var rectangles = cloudLayouter.GetRectangles();\n+            var rectangle = cloudLayouter.PutNextRectangle(rectangleSize);\n+\n+            return rectangles.Any(x => x.IntersectsWith(rectangle));\n+        }\n+\n+        [TestCase(1, 1, 8, ExpectedResult = false)]\n+        [TestCase(200, 51, 6, ExpectedResult = false)]\n+        [TestCase(278, 3, 17, ExpectedResult = false)]\n+        [TestCase(1210, 4012, 38, ExpectedResult = false)]\n+        [TestCase(555, 60, 87, ExpectedResult = false)]\n+        public bool OldRectangles_NewRectangleAddedToCloud_DoNotIntersectWithEachOther(int width, int height, int count)\n+        {\n+            var rectangleSize = new Size(width, height);\n+\n+            if (count == 0)\n+                return false;\n+            for (var i = 0; i < count; i++)\n+                cloudLayouter.PutNextRectangle(rectangleSize);\n+            var oldRectangles = cloudLayouter.GetRectangles();\n+            cloudLayouter.PutNextRectangle(rectangleSize);\n+\n+\n+            foreach (var rectangle in oldRectangles)\n+            {\n+                var rectangles = oldRectangles.Where(x => !x.Equals(rectangle));\n+                if (rectangles.Any(x => x.IntersectsWith(rectangle)))\n+                    return true;\n+            }\n+            return false;\n+        }\n+    }\n+}","path":"TagsCloudVisualization/CircularCloudLayouterTests.cs","position":124,"original_position":124,"commit_id":"e876b662d2f5d0116896214633056ab43142f6f2","original_commit_id":"e876b662d2f5d0116896214633056ab43142f6f2","user":{"login":"mironov-alexey","id":6783167,"avatar_url":"https://avatars.githubusercontent.com/u/6783167?v=3","gravatar_id":"","url":"https://api.github.com/users/mironov-alexey","html_url":"https://github.com/mironov-alexey","followers_url":"https://api.github.com/users/mironov-alexey/followers","following_url":"https://api.github.com/users/mironov-alexey/following{/other_user}","gists_url":"https://api.github.com/users/mironov-alexey/gists{/gist_id}","starred_url":"https://api.github.com/users/mironov-alexey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mironov-alexey/subscriptions","organizations_url":"https://api.github.com/users/mironov-alexey/orgs","repos_url":"https://api.github.com/users/mironov-alexey/repos","events_url":"https://api.github.com/users/mironov-alexey/events{/privacy}","received_events_url":"https://api.github.com/users/mironov-alexey/received_events","type":"User","site_admin":false},"body":"ок, жду тесты-проверки на боле-менее круглую форму :)","created_at":"2016-10-26T17:25:26Z","updated_at":"2016-10-26T17:25:26Z","html_url":"https://github.com/Saylala/tdd/pull/1#discussion_r85175519","pull_request_url":"https://api.github.com/repos/Saylala/tdd/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/Saylala/tdd/pulls/comments/85175519"},"html":{"href":"https://github.com/Saylala/tdd/pull/1#discussion_r85175519"},"pull_request":{"href":"https://api.github.com/repos/Saylala/tdd/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Saylala/tdd/pulls/1","id":91046606,"html_url":"https://github.com/Saylala/tdd/pull/1","diff_url":"https://github.com/Saylala/tdd/pull/1.diff","patch_url":"https://github.com/Saylala/tdd/pull/1.patch","issue_url":"https://api.github.com/repos/Saylala/tdd/issues/1","number":1,"state":"open","locked":false,"title":"PR for review","user":{"login":"mironov-alexey","id":6783167,"avatar_url":"https://avatars.githubusercontent.com/u/6783167?v=3","gravatar_id":"","url":"https://api.github.com/users/mironov-alexey","html_url":"https://github.com/mironov-alexey","followers_url":"https://api.github.com/users/mironov-alexey/followers","following_url":"https://api.github.com/users/mironov-alexey/following{/other_user}","gists_url":"https://api.github.com/users/mironov-alexey/gists{/gist_id}","starred_url":"https://api.github.com/users/mironov-alexey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mironov-alexey/subscriptions","organizations_url":"https://api.github.com/users/mironov-alexey/orgs","repos_url":"https://api.github.com/users/mironov-alexey/repos","events_url":"https://api.github.com/users/mironov-alexey/events{/privacy}","received_events_url":"https://api.github.com/users/mironov-alexey/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-26T17:03:29Z","updated_at":"2016-10-26T17:29:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"99b5527b7b290e039451056d6b483ef3049e521e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Saylala/tdd/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Saylala/tdd/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Saylala/tdd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Saylala/tdd/issues/1/comments","statuses_url":"https://api.github.com/repos/Saylala/tdd/statuses/e876b662d2f5d0116896214633056ab43142f6f2","head":{"label":"Saylala:master","ref":"master","sha":"e876b662d2f5d0116896214633056ab43142f6f2","user":{"login":"Saylala","id":22800853,"avatar_url":"https://avatars.githubusercontent.com/u/22800853?v=3","gravatar_id":"","url":"https://api.github.com/users/Saylala","html_url":"https://github.com/Saylala","followers_url":"https://api.github.com/users/Saylala/followers","following_url":"https://api.github.com/users/Saylala/following{/other_user}","gists_url":"https://api.github.com/users/Saylala/gists{/gist_id}","starred_url":"https://api.github.com/users/Saylala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saylala/subscriptions","organizations_url":"https://api.github.com/users/Saylala/orgs","repos_url":"https://api.github.com/users/Saylala/repos","events_url":"https://api.github.com/users/Saylala/events{/privacy}","received_events_url":"https://api.github.com/users/Saylala/received_events","type":"User","site_admin":false},"repo":{"id":71161920,"name":"tdd","full_name":"Saylala/tdd","owner":{"login":"Saylala","id":22800853,"avatar_url":"https://avatars.githubusercontent.com/u/22800853?v=3","gravatar_id":"","url":"https://api.github.com/users/Saylala","html_url":"https://github.com/Saylala","followers_url":"https://api.github.com/users/Saylala/followers","following_url":"https://api.github.com/users/Saylala/following{/other_user}","gists_url":"https://api.github.com/users/Saylala/gists{/gist_id}","starred_url":"https://api.github.com/users/Saylala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saylala/subscriptions","organizations_url":"https://api.github.com/users/Saylala/orgs","repos_url":"https://api.github.com/users/Saylala/repos","events_url":"https://api.github.com/users/Saylala/events{/privacy}","received_events_url":"https://api.github.com/users/Saylala/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Saylala/tdd","description":null,"fork":true,"url":"https://api.github.com/repos/Saylala/tdd","forks_url":"https://api.github.com/repos/Saylala/tdd/forks","keys_url":"https://api.github.com/repos/Saylala/tdd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Saylala/tdd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Saylala/tdd/teams","hooks_url":"https://api.github.com/repos/Saylala/tdd/hooks","issue_events_url":"https://api.github.com/repos/Saylala/tdd/issues/events{/number}","events_url":"https://api.github.com/repos/Saylala/tdd/events","assignees_url":"https://api.github.com/repos/Saylala/tdd/assignees{/user}","branches_url":"https://api.github.com/repos/Saylala/tdd/branches{/branch}","tags_url":"https://api.github.com/repos/Saylala/tdd/tags","blobs_url":"https://api.github.com/repos/Saylala/tdd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Saylala/tdd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Saylala/tdd/git/refs{/sha}","trees_url":"https://api.github.com/repos/Saylala/tdd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Saylala/tdd/statuses/{sha}","languages_url":"https://api.github.com/repos/Saylala/tdd/languages","stargazers_url":"https://api.github.com/repos/Saylala/tdd/stargazers","contributors_url":"https://api.github.com/repos/Saylala/tdd/contributors","subscribers_url":"https://api.github.com/repos/Saylala/tdd/subscribers","subscription_url":"https://api.github.com/repos/Saylala/tdd/subscription","commits_url":"https://api.github.com/repos/Saylala/tdd/commits{/sha}","git_commits_url":"https://api.github.com/repos/Saylala/tdd/git/commits{/sha}","comments_url":"https://api.github.com/repos/Saylala/tdd/comments{/number}","issue_comment_url":"https://api.github.com/repos/Saylala/tdd/issues/comments{/number}","contents_url":"https://api.github.com/repos/Saylala/tdd/contents/{+path}","compare_url":"https://api.github.com/repos/Saylala/tdd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Saylala/tdd/merges","archive_url":"https://api.github.com/repos/Saylala/tdd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Saylala/tdd/downloads","issues_url":"https://api.github.com/repos/Saylala/tdd/issues{/number}","pulls_url":"https://api.github.com/repos/Saylala/tdd/pulls{/number}","milestones_url":"https://api.github.com/repos/Saylala/tdd/milestones{/number}","notifications_url":"https://api.github.com/repos/Saylala/tdd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Saylala/tdd/labels{/name}","releases_url":"https://api.github.com/repos/Saylala/tdd/releases{/id}","deployments_url":"https://api.github.com/repos/Saylala/tdd/deployments","created_at":"2016-10-17T17:07:28Z","updated_at":"2016-10-17T17:07:29Z","pushed_at":"2016-10-26T17:03:29Z","git_url":"git://github.com/Saylala/tdd.git","ssh_url":"git@github.com:Saylala/tdd.git","clone_url":"https://github.com/Saylala/tdd.git","svn_url":"https://github.com/Saylala/tdd","homepage":null,"size":1201,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Saylala:branch-for-pr","ref":"branch-for-pr","sha":"facd0492888c1a947f0b259014b89f1d8e0cad18","user":{"login":"Saylala","id":22800853,"avatar_url":"https://avatars.githubusercontent.com/u/22800853?v=3","gravatar_id":"","url":"https://api.github.com/users/Saylala","html_url":"https://github.com/Saylala","followers_url":"https://api.github.com/users/Saylala/followers","following_url":"https://api.github.com/users/Saylala/following{/other_user}","gists_url":"https://api.github.com/users/Saylala/gists{/gist_id}","starred_url":"https://api.github.com/users/Saylala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saylala/subscriptions","organizations_url":"https://api.github.com/users/Saylala/orgs","repos_url":"https://api.github.com/users/Saylala/repos","events_url":"https://api.github.com/users/Saylala/events{/privacy}","received_events_url":"https://api.github.com/users/Saylala/received_events","type":"User","site_admin":false},"repo":{"id":71161920,"name":"tdd","full_name":"Saylala/tdd","owner":{"login":"Saylala","id":22800853,"avatar_url":"https://avatars.githubusercontent.com/u/22800853?v=3","gravatar_id":"","url":"https://api.github.com/users/Saylala","html_url":"https://github.com/Saylala","followers_url":"https://api.github.com/users/Saylala/followers","following_url":"https://api.github.com/users/Saylala/following{/other_user}","gists_url":"https://api.github.com/users/Saylala/gists{/gist_id}","starred_url":"https://api.github.com/users/Saylala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saylala/subscriptions","organizations_url":"https://api.github.com/users/Saylala/orgs","repos_url":"https://api.github.com/users/Saylala/repos","events_url":"https://api.github.com/users/Saylala/events{/privacy}","received_events_url":"https://api.github.com/users/Saylala/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Saylala/tdd","description":null,"fork":true,"url":"https://api.github.com/repos/Saylala/tdd","forks_url":"https://api.github.com/repos/Saylala/tdd/forks","keys_url":"https://api.github.com/repos/Saylala/tdd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Saylala/tdd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Saylala/tdd/teams","hooks_url":"https://api.github.com/repos/Saylala/tdd/hooks","issue_events_url":"https://api.github.com/repos/Saylala/tdd/issues/events{/number}","events_url":"https://api.github.com/repos/Saylala/tdd/events","assignees_url":"https://api.github.com/repos/Saylala/tdd/assignees{/user}","branches_url":"https://api.github.com/repos/Saylala/tdd/branches{/branch}","tags_url":"https://api.github.com/repos/Saylala/tdd/tags","blobs_url":"https://api.github.com/repos/Saylala/tdd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Saylala/tdd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Saylala/tdd/git/refs{/sha}","trees_url":"https://api.github.com/repos/Saylala/tdd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Saylala/tdd/statuses/{sha}","languages_url":"https://api.github.com/repos/Saylala/tdd/languages","stargazers_url":"https://api.github.com/repos/Saylala/tdd/stargazers","contributors_url":"https://api.github.com/repos/Saylala/tdd/contributors","subscribers_url":"https://api.github.com/repos/Saylala/tdd/subscribers","subscription_url":"https://api.github.com/repos/Saylala/tdd/subscription","commits_url":"https://api.github.com/repos/Saylala/tdd/commits{/sha}","git_commits_url":"https://api.github.com/repos/Saylala/tdd/git/commits{/sha}","comments_url":"https://api.github.com/repos/Saylala/tdd/comments{/number}","issue_comment_url":"https://api.github.com/repos/Saylala/tdd/issues/comments{/number}","contents_url":"https://api.github.com/repos/Saylala/tdd/contents/{+path}","compare_url":"https://api.github.com/repos/Saylala/tdd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Saylala/tdd/merges","archive_url":"https://api.github.com/repos/Saylala/tdd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Saylala/tdd/downloads","issues_url":"https://api.github.com/repos/Saylala/tdd/issues{/number}","pulls_url":"https://api.github.com/repos/Saylala/tdd/pulls{/number}","milestones_url":"https://api.github.com/repos/Saylala/tdd/milestones{/number}","notifications_url":"https://api.github.com/repos/Saylala/tdd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Saylala/tdd/labels{/name}","releases_url":"https://api.github.com/repos/Saylala/tdd/releases{/id}","deployments_url":"https://api.github.com/repos/Saylala/tdd/deployments","created_at":"2016-10-17T17:07:28Z","updated_at":"2016-10-17T17:07:29Z","pushed_at":"2016-10-26T17:03:29Z","git_url":"git://github.com/Saylala/tdd.git","ssh_url":"git@github.com:Saylala/tdd.git","clone_url":"https://github.com/Saylala/tdd.git","svn_url":"https://github.com/Saylala/tdd","homepage":null,"size":1201,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Saylala/tdd/pulls/1"},"html":{"href":"https://github.com/Saylala/tdd/pull/1"},"issue":{"href":"https://api.github.com/repos/Saylala/tdd/issues/1"},"comments":{"href":"https://api.github.com/repos/Saylala/tdd/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Saylala/tdd/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Saylala/tdd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Saylala/tdd/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Saylala/tdd/statuses/e876b662d2f5d0116896214633056ab43142f6f2"}}}}
{"actor":{"display_login":"mironov-alexey"}}