-
Notifications
You must be signed in to change notification settings - Fork 320
Шептихин Вячеслав #267
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
base: master
Are you sure you want to change the base?
Шептихин Вячеслав #267
Conversation
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
|
|
||
| <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.
Зачем здесь все эти зависимости? Обычно они нужны только для тестирования
| public List<MarkdownNode> Children { get; set; } = []; | ||
|
|
||
| public override string ToHtml() => | ||
| $"<strong>{string.Concat(Children.Select(child => child.ToHtml()))}</strong>"; |
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.
nit: Правильнее было бы использовать тег <b/>. Текущий чаще всего отображается также, но не на всех платформах, т.к. имеет немного более конкретный смысл
|
|
||
| public class HeaderNode : MarkdownNode | ||
| { | ||
| public int Level { get; set; } |
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.
Как будто бы ничто не мешает задать любой другой уровень заголовка, кроме 1-6, в т.ч. отрицательный
|
|
||
| public class BoldNode : MarkdownNode | ||
| { | ||
| public List<MarkdownNode> Children { get; set; } = []; |
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.
Хорошо бы сделать все это (в т.ч. в остальных нодах) иммутабельным. Т.е. init вместо set, IReadonlyCollection вместо List, добавить модификатор required, чтобы гарантировать наличие поля и не присваивать ничего по умолчанию
| @@ -0,0 +1,9 @@ | |||
| namespace Markdown.Parsing.Nodes; | |||
|
|
|||
| public class BoldNode : MarkdownNode | |||
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.
Я бы по возможности делал классы sealed. Это наноопотимизация для компилятора + заставит лишний раз подумать, при возникновении необходимости наследоваться
| [SetUp] | ||
| public void Setup() | ||
| { | ||
| tokenizer = new Tokenizer(); |
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.
По возможности лучше создавать это внутри конкретных тестов, т.к. может возникнуть необходимость передать различные параметры + дополнительная гарантия отсутствия влияния тестов друг на друга
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples", "Samples\Samples.csproj", "{C3EF41D7-50EF-4CE1-B30A-D1D81C93D7FA}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Markdown", "Markdown\Markdown.csproj", "{98BE1775-57AE-45F6-8921-DD3652ED05ED}" |
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.
На этом моменте понял, что реализация и тесты лежат в одном проекте. Обычно так не делают, заводят отдельный проект с названием ТестируемыйПроект.Tests, добавляют ему в зависимость тестируем проект и прочее необходимое для тестирования
No description provided.