Skip to content

Game#13

Open
Palezehvat wants to merge 3 commits intomasterfrom
Game
Open

Game#13
Palezehvat wants to merge 3 commits intomasterfrom
Game

Conversation

@Palezehvat
Copy link
Owner

Игра

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

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

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

@@ -0,0 +1,117 @@
namespace Game;

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

Choose a reason for hiding this comment

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

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

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

/// <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)

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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

{
int sizeLong = 0;
int sizeWidth = 0;
var file = new StreamReader(fileWithMap);

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

И using надо

int sizeLong = 0;
int sizeWidth = 0;
var file = new StreamReader(fileWithMap);
int sizeDogSymbols = 0;

Choose a reason for hiding this comment

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

Он не Dog, он At

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;

Choose a reason for hiding this comment

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

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

listKeys.RemoveAt(0);
switch (key)
{
case (char)37:

Choose a reason for hiding this comment

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

:(


public class Program
{
public static void Main()

Choose a reason for hiding this comment

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

Это не нужно


public class Tests
{
Game game;

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;

[TestCaseSource(nameof(GameForTest))]
public void TheIncorrectMapWithIncorrectSymbolShouldThrowException(Game game)
{
EventLoop eventLoop = new EventLoop();

Choose a reason for hiding this comment

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

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

Comment on lines 211 to 215
private static IEnumerable<TestCaseData> GameForTest
=> new TestCaseData[]
{
new TestCaseData(new Game())
};

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

Comments