Skip to content
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

Шевырин Никита #14

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

alexadralt
Copy link

No description provided.

Copy link

@PeterMotorniy PeterMotorniy left a comment

Choose a reason for hiding this comment

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

Промежуточное ревью

actualTsar.Should().BeEquivalentTo(expectedTsar,
options => options
.AllowingInfiniteRecursion()
.Excluding(x => x.Path.EndsWith("Id")));

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.Id), то тест падает с сообщением Expected field actualTsar.Parent.Id to be 2, but found 0. То есть он сравнивает поля Id у объектов Person, находящихся в поле Parent. Но как я понял мы хотим этого избежать

ClassicAssert.IsFalse(new NumberValidator(3, 2, true).IsValidNumber("a.sd"));
public void NumberValidator_DoesNotThrowOnCreation_WithCorrectArguments()
{
using (new AssertionScope())

This comment was marked as resolved.

{
using (new AssertionScope())
{
new Action(() => new NumberValidator(1, 2, false)).Should().Throw<ArgumentException>();

This comment was marked as resolved.

}
}

[Test]

This comment was marked as resolved.

var numberValidator = new NumberValidator(4, 2, true);
var validNumbers = new[]
{
"0.0", "0,0", "0", "1.23", "+0.00", "01.10", "+0,00", "1,0"

This comment was marked as resolved.

var numberValidatorWithScaleOfZero = new NumberValidator(2, 0, true);
var validNumbersWithScaleOfZero = new[]
{
"1", "+0", "01", "00"

This comment was marked as resolved.

ClassicAssert.AreEqual(expectedTsar.Parent.Parent, actualTsar.Parent.Parent);
actualTsar.Should().BeEquivalentTo(expectedTsar,
options => options
.AllowingInfiniteRecursion()

This comment was marked as resolved.

@@ -35,6 +39,7 @@ public void CheckCurrentTsar_WithCustomEquality()
new Person("Vasili III of Russia", 28, 170, 60, null));

// Какие недостатки у такого подхода?
// нужно прописывать отдельное сравнение для каждого нового свойства

This comment was marked as resolved.

ClassicAssert.IsFalse(new NumberValidator(17, 2, true).IsValidNumber("0.000"));
ClassicAssert.IsFalse(new NumberValidator(3, 2, true).IsValidNumber("-1.23"));
ClassicAssert.IsFalse(new NumberValidator(3, 2, true).IsValidNumber("a.sd"));
[TestCase(1, 0, true)]

Choose a reason for hiding this comment

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

Давай добавим Description или название теста, а то просто по входным данным может быть непонятно, что мы тестируем

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