diff --git a/Tests/HelpersUtilsTest.cs b/Tests/HelpersUtilsTest.cs index ef79750..9fc205b 100644 --- a/Tests/HelpersUtilsTest.cs +++ b/Tests/HelpersUtilsTest.cs @@ -17,46 +17,56 @@ namespace Tests { [Test] public void Test_KmwToOe() { - for (int i = 0; i < Gradation.GetLength(0); i++) { - Assert.AreEqual(Gradation[i, 1], Utils.KmwToOe(Gradation[i, 0])); - } + Assert.Multiple(() => { + for (int i = 0; i < Gradation.GetLength(0); i++) { + Assert.That(Utils.KmwToOe(Gradation[i, 0]), Is.EqualTo(Gradation[i, 1])); + } + }); } [Test] public void Test_OeToKmw() { - for (int i = 0; i < Gradation.GetLength(0); i++) { - Assert.AreEqual(Gradation[i, 0], Utils.OeToKmw(Gradation[i, 1])); - } + Assert.Multiple(() => { + for (int i = 0; i < Gradation.GetLength(0); i++) { + Assert.That(Utils.OeToKmw(Gradation[i, 1]), Is.EqualTo(Gradation[i, 0])); + } + }); } [Test] public void Test_DecFromDb() { - Assert.AreEqual(10.67M, Utils.DecFromDb(10670, 3)); - Assert.AreEqual(-100.9999M, Utils.DecFromDb(-1009999, 4)); - Assert.AreEqual(0.01M, Utils.DecFromDb(1, 2)); + Assert.Multiple(() => { + Assert.That(Utils.DecFromDb(10670, 3), Is.EqualTo(10.67M)); + Assert.That(Utils.DecFromDb(-1009999, 4), Is.EqualTo(-100.9999M)); + Assert.That(Utils.DecFromDb(1, 2), Is.EqualTo(0.01M)); + }); } [Test] public void Test_DecToDb() { - Assert.AreEqual(21948, Utils.DecToDb(219.48M, 2)); - Assert.AreEqual(-12345, Utils.DecToDb(-1.2345M, 4)); - Assert.AreEqual(99190, Utils.DecToDb(99190, 0)); - Assert.AreEqual(817910, Utils.DecToDb(817.9099M, 3)); - Assert.AreEqual(-561894, Utils.DecToDb(-5618.944M, 2)); + Assert.Multiple(() => { + Assert.That(Utils.DecToDb(219.48M, 2), Is.EqualTo(21948)); + Assert.That(Utils.DecToDb(-1.2345M, 4), Is.EqualTo(-12345)); + Assert.That(Utils.DecToDb(99190, 0), Is.EqualTo(99190)); + Assert.That(Utils.DecToDb(817.9099M, 3), Is.EqualTo(817910)); + Assert.That(Utils.DecToDb(-5618.944M, 2), Is.EqualTo(-561894)); + }); } [Test] public void Test_Modulo() { - Assert.AreEqual(1, Utils.Modulo("1", 2)); - Assert.AreEqual(1, Utils.Modulo("12", 11)); - Assert.AreEqual(1, Utils.Modulo("65", 16)); - Assert.AreEqual(4, Utils.Modulo("91746381048364", 10)); - Assert.AreEqual(1, Utils.Modulo("210501700012345678131468", 97)); - Assert.Throws(() => Utils.Modulo("", 4)); - Assert.Throws(() => Utils.Modulo("1ab", 5)); - Assert.Throws(() => Utils.Modulo("123", 1)); - Assert.Throws(() => Utils.Modulo("456", 0)); - Assert.Throws(() => Utils.Modulo("789", -1)); + Assert.Multiple(() => { + Assert.That(Utils.Modulo("1", 2), Is.EqualTo(1)); + Assert.That(Utils.Modulo("12", 11), Is.EqualTo(1)); + Assert.That(Utils.Modulo("65", 16), Is.EqualTo(1)); + Assert.That(Utils.Modulo("91746381048364", 10), Is.EqualTo(4)); + Assert.That(Utils.Modulo("210501700012345678131468", 97), Is.EqualTo(1)); + Assert.Throws(() => Utils.Modulo("", 4)); + Assert.Throws(() => Utils.Modulo("1ab", 5)); + Assert.Throws(() => Utils.Modulo("123", 1)); + Assert.Throws(() => Utils.Modulo("456", 0)); + Assert.Throws(() => Utils.Modulo("789", -1)); + }); } } } diff --git a/Tests/HelpersValidatorTest.cs b/Tests/HelpersValidatorTest.cs index 800f651..992ac16 100644 --- a/Tests/HelpersValidatorTest.cs +++ b/Tests/HelpersValidatorTest.cs @@ -15,12 +15,14 @@ namespace Tests { [Test] public void Test_CheckInteger_Simple() { - Assert.IsFalse(Validator.CheckInteger(CreateTextBox(""), true).IsValid); - Assert.IsTrue(Validator.CheckInteger(CreateTextBox(""), false).IsValid); - Assert.IsTrue(Validator.CheckInteger(CreateTextBox("123"), true).IsValid); - Assert.IsTrue(Validator.CheckInteger(CreateTextBox("456"), false).IsValid); - Assert.IsTrue(Validator.CheckInteger(CreateTextBox("1234"), false, 4).IsValid); - Assert.IsTrue(Validator.CheckInteger(CreateTextBox("4567"), false, 3).IsValid); + Assert.Multiple(() => { + Assert.That(Validator.CheckInteger(CreateTextBox(""), true).IsValid, Is.False); + Assert.That(Validator.CheckInteger(CreateTextBox(""), false).IsValid, Is.True); + Assert.That(Validator.CheckInteger(CreateTextBox("123"), true).IsValid, Is.True); + Assert.That(Validator.CheckInteger(CreateTextBox("456"), false).IsValid, Is.True); + Assert.That(Validator.CheckInteger(CreateTextBox("1234"), false, 4).IsValid, Is.True); + Assert.That(Validator.CheckInteger(CreateTextBox("4567"), false, 3).IsValid, Is.True); + }); } } }