sharee.bike-App/SharedBusinessLogic.Tests/Model/Connector/Filter/TestIntersectGroupFilterHelper.cs

72 lines
1.7 KiB
C#
Raw Normal View History

2024-04-09 12:53:23 +02:00
using System.Collections.Generic;
2021-11-07 21:28:13 +01:00
using System.Linq;
2022-08-30 15:42:25 +02:00
using NUnit.Framework;
2024-04-09 12:53:23 +02:00
using ShareeBike.Model.Connector.Filter;
using NUnit.Framework.Legacy;
2021-11-07 21:28:13 +01:00
2024-04-09 12:53:23 +02:00
namespace SharedBusinessLogic.Tests.Model.Connector.Filter
2021-11-07 21:28:13 +01:00
{
2022-09-06 16:08:19 +02:00
[TestFixture]
public class TestIntersectGroupFilterHelper
{
[Test]
public void TestGetBikeCategory()
{
2024-04-09 12:53:23 +02:00
Assert.That(
"Fr_300102".GetBikeCategory(), Is.EqualTo("300102").AsCollection);
2022-09-06 16:08:19 +02:00
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestGetBikeCategoryEmpty()
{
2024-04-09 12:53:23 +02:00
Assert.That(
"CAD_".GetBikeCategory(), Is.EqualTo("").AsCollection);
2022-09-06 16:08:19 +02:00
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestToBikeCategory()
{
2024-04-09 12:53:23 +02:00
Assert.That(
IntersectGroupFilterHelper.ToBikeCategory(new List<string> { "KN_300102", "Bla_XXX", "FR_777" }), Is.EqualTo(new List<string> { "300102", "777" }).AsCollection);
2022-09-06 16:08:19 +02:00
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestToBikeCategoryEmpty()
{
Assert.That(
IntersectGroupFilterHelper.ToBikeCategory(new List<string> { "KN_" }).Count(),
Is.EqualTo(0));
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestIntersectByGoupId()
{
2024-04-09 12:53:23 +02:00
Assert.That(
new List<string> { "FR_300101", "XY_777" }.IntersectByGoupId(new List<string> { "XY_776", "KN_300101" }), Is.EqualTo(new List<string> { "FR_300101" }).AsCollection);
2022-09-06 16:08:19 +02:00
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestIntersectByGoupId_Empty()
{
2024-04-09 12:53:23 +02:00
Assert.That(
new List<string> { "FR_300102" }.IntersectByGoupId(new List<string> { "FR_300101" }), Is.EqualTo(new List<string>()).AsCollection);
2022-09-06 16:08:19 +02:00
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestContainsGroupId_True()
{
Assert.That(
new List<string> { "FR_300101", "XY_777" }.ContainsGroupId("KN_300101"),
Is.True);
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestContainsGroupId_False()
{
Assert.That(
new List<string> { "FR_300101", "XY_777" }.ContainsGroupId("XY_776"),
Is.False);
}
}
2021-11-07 21:28:13 +01:00
}