Skip to content

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

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

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

Conversation

@maks-march

Copy link
Copy Markdown

Наставник @InTheNameOfYarik

Comment thread Testing/Basic/Homework/1. ObjectComparison/ObjectComparison.cs Outdated
Comment thread Testing/Basic/Homework/1. ObjectComparison/ObjectComparison.cs Outdated
Comment thread Testing/Basic/Homework/2. NumberValidator/NumberValidatorTests.cs
Comment thread Testing/Basic/Homework/2. NumberValidator/NumberValidatorTests.cs Outdated
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);

Copy link
Copy Markdown

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 =>

Copy link
Copy Markdown

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