Skip to content

ДЗ Марченко Максим#42

Open
maks-march wants to merge 5 commits intokontur-courses:masterfrom
maks-march:master
Open

ДЗ Марченко Максим#42
maks-march wants to merge 5 commits intokontur-courses:masterfrom
maks-march:master

Conversation

@maks-march
Copy link

Наставник @InTheNameOfYarik

private static Person person0ParentsLimitsCopy = Person.Copy(person0ParentsLimits);
private static Person person1Parents = new Person("1", 1, 1, 1, new Person("2", 2, 2, 2, null));
private static Person person1ParentsСopy = new Person("1", 1, 1, 1, new Person("2", 2, 2, 2, null));
private static Person person1ParentsСopy = Person.Copy(person1Parents);

Choose a reason for hiding this comment

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

Это просто заметка по кодстайлу, в разных коммандах разное бывает принято, но давай сделаем вот так:
Хорошо, что добавил копирование, но тогда лучше добавь в Person, что-то типа такого
public Person Copy() => Copy(this)!;
И явно указать, что родитель nullable: Person? parent
Так не будет показывать варнингов из-за null ссылок. И соответственно замени все Person.Copy(p) на p.Copy()

actual.Should().BeEquivalentTo(expected, options =>
options
.Excluding(t => t.Id)
.Using<Person>(ctx =>

Choose a reason for hiding this comment

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

Тут я имел ввиду использовать options .Excluding(t => t.Path.EndsWith("Id")). FluentAssertions умеет создавать путь у свойств так что все вложенные Id будут выглядеть типа person.Id, person.Parent.Id, person.Parent.Parent.Id и т.д.

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.

2 participants