Skip to content

Ситдиков Сергей#62

Open
s1lenter wants to merge 2 commits intokontur-courses:masterfrom
s1lenter:master
Open

Ситдиков Сергей#62
s1lenter wants to merge 2 commits intokontur-courses:masterfrom
s1lenter:master

Conversation

@s1lenter
Copy link

ClassicAssert.AreEqual(expectedTsar.Parent.Age, actualTsar.Parent.Age);
ClassicAssert.AreEqual(expectedTsar.Parent.Height, actualTsar.Parent.Height);
ClassicAssert.AreEqual(expectedTsar.Parent.Parent, actualTsar.Parent.Parent);
actualTsar.Should().BeEquivalentTo(expectedTsar,

This comment was marked as resolved.

Copy link
Author

Choose a reason for hiding this comment

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

Тест упадет, чтобы не дописывать нужно проигнорировать каждый элемент с помощью .Excluding(x => x.DeclaringType == typeof(Person) && x.Name == nameof(Person.Id)), тогда вложенные элементы тоже будут проверяться

// Какие недостатки у такого подхода?
ClassicAssert.True(AreEqual(actualTsar, expectedTsar));

// Недостаток такого подхода заключается в том, что мы добавялем метод,

This comment was marked as resolved.

Copy link
Author

Choose a reason for hiding this comment

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

Тест выдаст ошибку что есть циклическая ссылка, поэтому можно использовать .IgnoringCyclicReferences());
В указанном подходе еще есть недостаток в том, что нет понятного сообщения об ошибке в тесте и ссылка на сам объект внутри него тоже не сработает

[Test]
[TestCase(1, 2)]
[TestCase(1, 1)]
public void Should_ThrowException_WhenPositivePrecisionLessOrEqualScale(int precision, int scale)

This comment was marked as resolved.

{
var createValidator = () => new NumberValidator(1, -1, true);

createValidator.Should().Throw<ArgumentException>()

This comment was marked as resolved.

createValidator.Should().NotThrow();
}

[Test]

Choose a reason for hiding this comment

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

[Test] лишний, если есть TestCase

Choose a reason for hiding this comment

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

Все еще осталась такая же проблема в ConstructorShould_NotThrowException_WhenValidParameters

}

[Test]
[TestCase("aaa")]

This comment was marked as resolved.

@@ -0,0 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

Choose a reason for hiding this comment

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

У тебя какие-то лишние файлы в коммит попали почему-то, помимо тестов

Choose a reason for hiding this comment

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

Все еще остались какие-то непонятные изменения gitignore и других фаликах, которые кажется не нужны

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