-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Зиновьева Милана #244
base: master
Are you sure you want to change the base?
Зиновьева Милана #244
Conversation
cs/Samples/Samples.csproj
Outdated
<PackageReference Include="xunit" Version="2.8.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не используемые зависимости стоит удалить
cs/TagsCloudVisualization/Spiral.cs
Outdated
|
||
namespace Layouter; | ||
|
||
class Spiral |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Название не передает сути
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Стоит поправить
foreach(Rectangle rectangle in rectangles){ | ||
if (rectangleChecked.IntersectsWith(rectangle)) | ||
return true; | ||
} | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Предлагаю переписать на linq
[Test] | ||
public void PutNextRectangle_PutSeveralRectangles(){ | ||
Size rectangleSize = new Size(3, 7); | ||
for(int i = 0;i < 20;i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Стоит использовать автоформатирование кода. Если используешь райдер, можно настроить автоформатирование при коммите
cs/TagsCloudVisualization/Spiral.cs
Outdated
|
||
namespace Layouter; | ||
|
||
class Spiral |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Стоит поправить
canvas.FillRectangle(rect.X, rect.Y, | ||
rect.Width, | ||
rect.Height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
При разбиении на строки, стоит либо на каждый аргумент выделять строку, либо в каждую строку помещать элементы вплоть до стандартной границы. Тут всё влезет на одну строку
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Выдели тесты в отдельный проект
} | ||
|
||
[Test] | ||
public void PutNextRectangle_LessThanAreaOfCircle() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Наоборот быть и не может, тест не имеет смысла
circularCloudLayouter.GetRectangles.Count().Should().Be(1); | ||
circularCloudLayouter.GetRectangles.Should().Contain(expectedRectangle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collection.Should().ContainSingle()
https://fluentassertions.com/collections/
{ | ||
circularCloudLayouter.PutNextRectangle(rectangleSize); | ||
} | ||
circularCloudLayouter.GetRectangles.Count().Should().Be(20); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collection.Should().HaveCount()
https://fluentassertions.com/collections/
|
||
private List<Rectangle> rectangles; | ||
|
||
public Point GetCenter => centercloud; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
опечатка
private ICanvas Draw(ICanvas canvas) | ||
{ | ||
canvas.FillColor = Colors.Blue; | ||
canvas.FontColor = Colors.Black; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем ты дважды задала цвет шрифту?
return rectangle; | ||
} | ||
|
||
private Rectangle CanMove(Rectangle rectangle, bool isX, int direction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can
в названии подразумевает, что вернется bool из метода и он не будет что-то менять. Стоит переименовать
var movedRectangle = new Rectangle( | ||
new Point(rectangle.X + shiftPoint.X, rectangle.Y + shiftPoint.Y), | ||
rectangle.Size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Посмотри на with expression
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/with-expression
drawingTagsCloud.SaveToFile("Failed.png"); //сохраняется в bin | ||
Console.WriteLine("Tag cloud visualization saved to file Failed.png"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А если упадет несколько тестов?
<ItemGroup> | ||
<PackageReference Include="NUnit" Version="3.14.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="NUnit.Framework" /> | ||
</ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Неиспользуемые пакеты стоит удалять из проекта
do | ||
{ | ||
Point nextPoint = spiral.GetNextPoint(); | ||
tempRectangle = new Rectangle(new Point(nextPoint.X, nextPoint.Y), rectangleSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
так же можно было использовать with expression
private readonly System.Drawing.Point centercloud; | ||
private readonly List<Rectangle> rectangles; | ||
|
||
public DrawingTagsCloud(System.Drawing.Point center, List<Rectangle> rectanglesInput) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Указание типа точки можно сделать короче
No description provided.