Open
Conversation
yurii-litvinov
suggested changes
May 25, 2023
yurii-litvinov
left a comment
There was a problem hiding this comment.
Вы, видимо, всё делаете втрое сложнее, чем надо. Решение архитектурно полная каша, и неэлегантно :)
| @@ -0,0 +1,117 @@ | |||
| namespace Game; | |||
|
|
|||
| public delegate void ArrowHandler(int startPositionLeft, int startPositionTop, WorkWithConsole data, ref List<((int, int), char)> forTests); | |||
There was a problem hiding this comment.
Обожечтоэто.
- Делегаты не нужны, используйте 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) |
There was a problem hiding this comment.
Предполагалось, что тут будут использоваться события, а не явная передача делегатов, как в 2005-м году
| { | ||
| int sizeLong = 0; | ||
| int sizeWidth = 0; | ||
| var file = new StreamReader(fileWithMap); |
There was a problem hiding this comment.
EventLoop не должен ничего знать про карту
Game/Game/EventLoop.cs
Outdated
| int sizeLong = 0; | ||
| int sizeWidth = 0; | ||
| var file = new StreamReader(fileWithMap); | ||
| int sizeDogSymbols = 0; |
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; |
There was a problem hiding this comment.
Это "размер в длину", что ли? :)
Game/Game/PrintInList.cs
Outdated
| listKeys.RemoveAt(0); | ||
| switch (key) | ||
| { | ||
| case (char)37: |
|
|
||
| public class Program | ||
| { | ||
| public static void Main() |
Game/TestsForGame/TestsForGame.cs
Outdated
|
|
||
| public class Tests | ||
| { | ||
| Game game; |
There was a problem hiding this comment.
Suggested change
| Game game; | |
| private Game game; |
Game/TestsForGame/TestsForGame.cs
Outdated
| [TestCaseSource(nameof(GameForTest))] | ||
| public void TheIncorrectMapWithIncorrectSymbolShouldThrowException(Game game) | ||
| { | ||
| EventLoop eventLoop = new EventLoop(); |
There was a problem hiding this comment.
Это в каждом тесте делается, вынесли бы в SetUp
Game/TestsForGame/TestsForGame.cs
Outdated
Comment on lines
211
to
215
| private static IEnumerable<TestCaseData> GameForTest | ||
| => new TestCaseData[] | ||
| { | ||
| new TestCaseData(new Game()) | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Игра