Skip to content

Game - #13

Open
Palezehvat wants to merge 3 commits into
masterfrom
Game
Open

Game#13
Palezehvat wants to merge 3 commits into
masterfrom
Game

Conversation

@Palezehvat

Copy link
Copy Markdown
Owner

Игра

@yurii-litvinov yurii-litvinov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вы, видимо, всё делаете втрое сложнее, чем надо. Решение архитектурно полная каша, и неэлегантно :)

Comment thread Game/Game/EventLoop.cs
@@ -0,0 +1,117 @@
namespace Game;

public delegate void ArrowHandler(int startPositionLeft, int startPositionTop, WorkWithConsole data, ref List<((int, int), char)> forTests);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Обожечтоэто.

  • Делегаты не нужны, используйте Action
  • Код специально для тестов в боевом коде никто не пишет (без крайней нужды, а тут нет крайней нужды)
  • Как-то это суперсложно, этот делегад вообще должен быть без параметров

Comment thread Game/Game/EventLoop.cs
/// <exception cref="InvalidMapException">Incorrectly set map</exception>
/// <exception cref="NullReferenceException">Checking that the read card line is not empty</exception>
public void Run(ArrowHandler left, ArrowHandler right, ArrowHandler up, ArrowHandler down,
string fileWithMap, WorkWithConsole data, ref List<((int, int), char)> forTests, List<Char> listKeys = null)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предполагалось, что тут будут использоваться события, а не явная передача делегатов, как в 2005-м году

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И nullability надо поправить

Comment thread Game/Game/EventLoop.cs
{
int sizeLong = 0;
int sizeWidth = 0;
var file = new StreamReader(fileWithMap);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EventLoop не должен ничего знать про карту

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И using надо

Comment thread Game/Game/EventLoop.cs Outdated
int sizeLong = 0;
int sizeWidth = 0;
var file = new StreamReader(fileWithMap);
int sizeDogSymbols = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Он не Dog, он At

Comment thread Game/Game/EventLoop.cs Outdated
public void Run(ArrowHandler left, ArrowHandler right, ArrowHandler up, ArrowHandler down,
string fileWithMap, WorkWithConsole data, ref List<((int, int), char)> forTests, List<Char> listKeys = null)
{
int sizeLong = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это "размер в длину", что ли? :)

Comment thread Game/Game/PrintInList.cs Outdated
listKeys.RemoveAt(0);
switch (key)
{
case (char)37:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

Comment thread Game/Game/Program.cs

public class Program
{
public static void Main()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это не нужно

Comment thread Game/TestsForGame/TestsForGame.cs Outdated

public class Tests
{
Game game;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Game game;
private Game game;

Comment thread Game/TestsForGame/TestsForGame.cs Outdated
[TestCaseSource(nameof(GameForTest))]
public void TheIncorrectMapWithIncorrectSymbolShouldThrowException(Game game)
{
EventLoop eventLoop = new EventLoop();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это в каждом тесте делается, вынесли бы в SetUp

Comment thread Game/TestsForGame/TestsForGame.cs Outdated
Comment on lines +211 to +215
private static IEnumerable<TestCaseData> GameForTest
=> new TestCaseData[]
{
new TestCaseData(new Game())
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants