From 20c41b307166fef495c03ac16ac18d8e2f41ae72 Mon Sep 17 00:00:00 2001 From: Andrei Sergeev Date: Sat, 8 Jun 2024 11:24:50 +0400 Subject: [PATCH] Minot refactor building test cases --- ...rializationTests.DeserializeValueToUnit.cs | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/core-unit/Unit.Tests/UnitSerializationTests/UnitSerializationTests.DeserializeValueToUnit.cs b/src/core-unit/Unit.Tests/UnitSerializationTests/UnitSerializationTests.DeserializeValueToUnit.cs index 693d35b..52cdc0c 100644 --- a/src/core-unit/Unit.Tests/UnitSerializationTests/UnitSerializationTests.DeserializeValueToUnit.cs +++ b/src/core-unit/Unit.Tests/UnitSerializationTests/UnitSerializationTests.DeserializeValueToUnit.cs @@ -49,29 +49,9 @@ public static void DeserializeDtoWithValueToDtoWithUnitFromObject_ExpectNoExcept { get { - IEnumerable values = - [ - JsonValue.Create(true), - JsonValue.Create(false), - - JsonValue.Create(int.MinValue), - JsonValue.Create(-1), - JsonValue.Create(0), - JsonValue.Create(1.1m), - JsonValue.Create(1.2), - JsonValue.Create(int.MaxValue), - - JsonValue.Create(double.MinValue), - JsonValue.Create(double.MaxValue), - - JsonValue.Create(""), - JsonValue.Create("1"), - JsonValue.Create("0AFB2897-BA58-4E10-A083-4C33341B6238") - ]; - var result = new TheoryData(); - foreach (var value in values) + foreach (var value in EnumerateValues()) { foreach (var options in EnumerateJsonSerializerOptionsCases()) { @@ -80,6 +60,26 @@ public static void DeserializeDtoWithValueToDtoWithUnitFromObject_ExpectNoExcept } return result; + + static IEnumerable EnumerateValues() + { + yield return JsonValue.Create(true); + yield return JsonValue.Create(false); + + yield return JsonValue.Create(int.MinValue); + yield return JsonValue.Create(-1); + yield return JsonValue.Create(0); + yield return JsonValue.Create(1.1m); + yield return JsonValue.Create(1.2); + yield return JsonValue.Create(int.MaxValue); + + yield return JsonValue.Create(double.MinValue); + yield return JsonValue.Create(double.MaxValue); + + yield return JsonValue.Create(""); + yield return JsonValue.Create("1"); + yield return JsonValue.Create("0AFB2897-BA58-4E10-A083-4C33341B6238"); + } } } }