-
Notifications
You must be signed in to change notification settings - Fork 32
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
base: master
Are you sure you want to change the base?
Шевырин Никита #14
Conversation
There was a problem hiding this 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.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
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.
This comment was marked as resolved.
Sorry, something went wrong.
{ | ||
using (new AssertionScope()) | ||
{ | ||
new Action(() => new NumberValidator(1, 2, false)).Should().Throw<ArgumentException>(); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
} | ||
} | ||
|
||
[Test] |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
This comment was marked as resolved.
Sorry, something went wrong.
var numberValidatorWithScaleOfZero = new NumberValidator(2, 0, true); | ||
var validNumbersWithScaleOfZero = new[] | ||
{ | ||
"1", "+0", "01", "00" |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
ClassicAssert.AreEqual(expectedTsar.Parent.Parent, actualTsar.Parent.Parent); | ||
actualTsar.Should().BeEquivalentTo(expectedTsar, | ||
options => options | ||
.AllowingInfiniteRecursion() |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -35,6 +39,7 @@ public void CheckCurrentTsar_WithCustomEquality() | |||
new Person("Vasili III of Russia", 28, 170, 60, null)); | |||
|
|||
// Какие недостатки у такого подхода? | |||
// нужно прописывать отдельное сравнение для каждого нового свойства |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Давай добавим Description или название теста, а то просто по входным данным может быть непонятно, что мы тестируем
No description provided.