Skip to content

Commit

Permalink
Edit homework after code-review
Browse files Browse the repository at this point in the history
  • Loading branch information
dmseul committed Nov 6, 2024
1 parent 104c9c0 commit 7ace04c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ public void CheckCurrentTsar()
var expectedTsar = new Person("Ivan IV The Terrible", 54, 170, 70,
new Person("Vasili III of Russia", 28, 170, 60, null));

actualTsar.Should().BeEquivalentTo(expectedTsar, options => options
.Excluding(x => x.Id)
.Excluding(x => x.Parent.Id));
actualTsar.Should().BeEquivalentTo(expectedTsar, options => options.Excluding(x => x.Path.Contains("Id")));
}

[Test]
Expand All @@ -37,7 +35,7 @@ public void CheckCurrentTsar_WithCustomEquality()
// + сам ClassicAssert плохо читается в сравнении с FluentAssertion
//
// 2) Не расширяемый: при добавлении новых полей и свойств нужно будет править этот метод,
// тесты будут выполняться неверно или падать
// тесты будут выполняться неверно
//
// 3) Повторяющийся код сравнения свойств, выглядит не очень
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace HomeExercise.Tasks.NumberValidator;
[TestFixture]
public class NumberValidatorTests
{
[Test]
[TestCase(-1, 0, TestName = "NegativePrecision")]
[TestCase(0, 0, TestName = "ZeroPrecision")]
[TestCase(1, -1, TestName = "NegativeScale")]
Expand All @@ -17,15 +16,14 @@ public void ValidateConstructor_ThrowsException_WithUncorrectData(int precision,
act.Should().Throw<ArgumentException>();
}

[Test]
[TestCase(1, 0, TestName = "CorrectData")]
[TestCase(2, 1, TestName = "CorrectData")]
[TestCase(1, 0, TestName = "CorrectDataWithZeroScope")]
public void ValidateConstructor_DontThrowsException_WithCorrectData(int precision, int scale)
{
Action act = () => new NumberValidator(precision, scale);
act.Should().NotThrow();
Action action = () => new NumberValidator(precision, scale);
action.Should().NotThrow();
}

[Test]
[TestCase("0.0", true, true, TestName = "SimpleCorrectValueWithPoint")]
[TestCase("0,0", true, true, TestName = "SimpleCorrectValueWithComma")]
[TestCase("0", true, true, TestName = "SimpleDataWithoutValue")]
Expand Down

0 comments on commit 7ace04c

Please sign in to comment.