0
0

Improve t-piece parsing
All checks were successful
Test API / test (push) Successful in 2m8s

This commit is contained in:
Serghei Cebotari 2024-01-26 15:57:56 +03:00
parent a0a1c23c4d
commit 194d85fbfe
2 changed files with 10 additions and 1 deletions

View File

@ -15,6 +15,7 @@ public class RautitanFittingsTests : ProductQueryModifierTests
[TestCase("Тройник 20-16-16", "Тройник -PLATINUM 20-16-16")]
[TestCase("Тройник 20x16x16", "Тройник -PLATINUM 20-16-16")]
[TestCase("Тройник 20-16-25", "Тройник -PLATINUM 25-16-20")]
public void TPieceTest(string query, string modified)
=> Execute(productType: "Тройник RAUTITAN", query, modified);

View File

@ -10,6 +10,7 @@ public class TPiece : DrinkingWaterHeatingFitting
output = string.Empty;
var diameters = _diameter.Matches(input)
.Select(match => match.Groups["Diameter"].Value)
.Select(d => int.Parse(d))
.ToArray();
if (diameters.Length == 1)
{
@ -17,7 +18,14 @@ public class TPiece : DrinkingWaterHeatingFitting
}
else if (diameters.Length >= 3)
{
output = $"{_title} {diameters[0]}-{diameters[1]}-{diameters[2]}";
if (diameters[2] > diameters[0])
{
output = $"{_title} {diameters[2]}-{diameters[1]}-{diameters[0]}";
}
else
{
output = $"{_title} {diameters[0]}-{diameters[1]}-{diameters[2]}";
}
}
else
{