From 7ace04c3930f425751b69ec487c4ca402eda24c2 Mon Sep 17 00:00:00 2001 From: maakhhh Date: Wed, 6 Nov 2024 19:23:11 +0500 Subject: [PATCH] Edit homework after code-review --- .../Homework/1. ObjectComparison/ObjectComparison.cs | 6 ++---- .../2. NumberValidator/NumberValidatorTests.cs | 10 ++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Testing/Basic/Homework/1. ObjectComparison/ObjectComparison.cs b/Testing/Basic/Homework/1. ObjectComparison/ObjectComparison.cs index 6db73eb..a140c8d 100644 --- a/Testing/Basic/Homework/1. ObjectComparison/ObjectComparison.cs +++ b/Testing/Basic/Homework/1. ObjectComparison/ObjectComparison.cs @@ -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] @@ -37,7 +35,7 @@ public void CheckCurrentTsar_WithCustomEquality() // + сам ClassicAssert плохо читается в сравнении с FluentAssertion // // 2) Не расширяемый: при добавлении новых полей и свойств нужно будет править этот метод, - // тесты будут выполняться неверно или падать + // тесты будут выполняться неверно // // 3) Повторяющийся код сравнения свойств, выглядит не очень // diff --git a/Testing/Basic/Homework/2. NumberValidator/NumberValidatorTests.cs b/Testing/Basic/Homework/2. NumberValidator/NumberValidatorTests.cs index 905fc8c..4217301 100644 --- a/Testing/Basic/Homework/2. NumberValidator/NumberValidatorTests.cs +++ b/Testing/Basic/Homework/2. NumberValidator/NumberValidatorTests.cs @@ -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")] @@ -17,15 +16,14 @@ public void ValidateConstructor_ThrowsException_WithUncorrectData(int precision, act.Should().Throw(); } - [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")]