Conversation
| 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.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Тест упадет, чтобы не дописывать нужно проигнорировать каждый элемент с помощью .Excluding(x => x.DeclaringType == typeof(Person) && x.Name == nameof(Person.Id)), тогда вложенные элементы тоже будут проверяться
| // Какие недостатки у такого подхода? | ||
| ClassicAssert.True(AreEqual(actualTsar, expectedTsar)); | ||
|
|
||
| // Недостаток такого подхода заключается в том, что мы добавялем метод, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Тест выдаст ошибку что есть циклическая ссылка, поэтому можно использовать .IgnoringCyclicReferences());
В указанном подходе еще есть недостаток в том, что нет понятного сообщения об ошибке в тесте и ссылка на сам объект внутри него тоже не сработает
| [Test] | ||
| [TestCase(1, 2)] | ||
| [TestCase(1, 1)] | ||
| public void Should_ThrowException_WhenPositivePrecisionLessOrEqualScale(int precision, int scale) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| { | ||
| var createValidator = () => new NumberValidator(1, -1, true); | ||
|
|
||
| createValidator.Should().Throw<ArgumentException>() |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| createValidator.Should().NotThrow(); | ||
| } | ||
|
|
||
| [Test] |
There was a problem hiding this comment.
[Test] лишний, если есть TestCase
There was a problem hiding this comment.
Все еще осталась такая же проблема в ConstructorShould_NotThrowException_WhenValidParameters
| } | ||
|
|
||
| [Test] | ||
| [TestCase("aaa")] |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| @@ -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"> | |||
There was a problem hiding this comment.
У тебя какие-то лишние файлы в коммит попали почему-то, помимо тестов
There was a problem hiding this comment.
Все еще остались какие-то непонятные изменения gitignore и других фаликах, которые кажется не нужны
@PetrMot