diff options
author | Serghei Cebotari <serghei@cebotari.ru> | 2023-10-01 22:14:47 +0300 |
---|---|---|
committer | Serghei Cebotari <serghei@cebotari.ru> | 2023-10-01 22:14:47 +0300 |
commit | fe96662905550706ceb1c567403af8944bf9b029 (patch) | |
tree | 92e8b90fe520915b029c4118b6e28bcee33ee343 /RhSolutions.Api.Tests | |
parent | aa330461c6663af4caff56eb5fc93f3fd366dc06 (diff) |
Add coupling query modifier
Diffstat (limited to 'RhSolutions.Api.Tests')
-rw-r--r-- | RhSolutions.Api.Tests/ProductQueryModifierTests.cs | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/RhSolutions.Api.Tests/ProductQueryModifierTests.cs b/RhSolutions.Api.Tests/ProductQueryModifierTests.cs index 32bc140..0756d4f 100644 --- a/RhSolutions.Api.Tests/ProductQueryModifierTests.cs +++ b/RhSolutions.Api.Tests/ProductQueryModifierTests.cs @@ -6,35 +6,40 @@ namespace RhSolutions.Api.Tests; public class ProductQueryModifierTests { - private ProductQueryModifierFactory _factory; + private ProductQueryModifierFactory _factory; - [SetUp] - public void Setup() - { - _factory = new ProductQueryModifierFactory(); - } + [SetUp] + public void Setup() + { + _factory = new ProductQueryModifierFactory(); + } - [TestCase("Монтажная гильза", "Гильза 16", "Монтажная гильза 16")] - [TestCase("Монтажная гильза", "Пресс-втулка 20", "Монтажная гильза 20")] - public void SleeveTest(string productType, string query, string modified) => - Test(productType, query, modified); + [TestCase("Монтажная гильза", "Гильза 16", "Монтажная гильза 16")] + [TestCase("Монтажная гильза", "Пресс-втулка 20", "Монтажная гильза 20")] + public void SleeveTest(string productType, string query, string modified) => + Test(productType, query, modified); - [TestCase("Тройник RAUTITAN", "Тройник 20-16-16", "Тройник RAUTITAN -PLATINUM 20-16-16")] - [TestCase("Тройник RAUTITAN", "Тройник 20x16x16", "Тройник RAUTITAN -PLATINUM 20-16-16")] - public void TPieceTest(string productType, string query, string modified) => - Test(productType, query, modified); + [TestCase("Тройник RAUTITAN", "Тройник 20-16-16", "Тройник RAUTITAN -PLATINUM 20-16-16")] + [TestCase("Тройник RAUTITAN", "Тройник 20x16x16", "Тройник RAUTITAN -PLATINUM 20-16-16")] + public void TPieceTest(string productType, string query, string modified) => + Test(productType, query, modified); + + [TestCase("Муфта соединительная", "муфта 20", "Муфта соединительная равнопроходная 20")] + [TestCase("Муфта соединительная", "переходник 20-16", "Муфта соединительная переходная 20-16")] + public void CouplingTest(string productType, string query, string modified) => + Test(productType, query, modified); - public void Test(string productType, string query, string modified) - { - Dictionary<string, StringValues> queryPair = new() - { - ["query"] = new StringValues(query) - }; - QueryCollection collection = new(queryPair); - QueryString expected = new($"?query={Uri.EscapeDataString(modified)}"); - var modifier = _factory.GetModifier(productType); - bool result = modifier.TryQueryModify(collection, out var actual); - Assert.True(result); - Assert.That(actual, Is.EqualTo(expected)); - } + public void Test(string productType, string query, string modified) + { + Dictionary<string, StringValues> queryPair = new() + { + ["query"] = new StringValues(query) + }; + QueryCollection collection = new(queryPair); + QueryString expected = new($"?query={Uri.EscapeDataString(modified)}"); + var modifier = _factory.GetModifier(productType); + bool result = modifier.TryQueryModify(collection, out var actual); + Assert.True(result); + Assert.That(actual, Is.EqualTo(expected)); + } }
\ No newline at end of file |