sharee.bike-App/TestShareeLib/Model/Connector/Filter/TestIntersectGroupFilterHelper.cs

76 lines
1.6 KiB
C#
Raw Normal View History

2022-08-30 15:42:25 +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;
2021-11-07 21:28:13 +01:00
using TINK.Model.Connector.Filter;
namespace TestShareeLib.Model.Connector.Filter
{
2022-09-06 16:08:19 +02:00
[TestFixture]
public class TestIntersectGroupFilterHelper
{
[Test]
public void TestGetBikeCategory()
{
CollectionAssert.AreEqual(
"300102",
"Fr_300102".GetBikeCategory());
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestGetBikeCategoryEmpty()
{
CollectionAssert.AreEqual(
"",
"CAD_".GetBikeCategory());
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestToBikeCategory()
{
CollectionAssert.AreEqual(
new List<string> { "300102", "777" },
IntersectGroupFilterHelper.ToBikeCategory(new List<string> { "KN_300102", "Bla_XXX", "FR_777" }));
}
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()
{
CollectionAssert.AreEqual(
new List<string> { "FR_300101" },
new List<string> { "FR_300101", "XY_777" }.IntersectByGoupId(new List<string> { "XY_776", "KN_300101" }));
}
2021-11-07 21:28:13 +01:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestIntersectByGoupId_Empty()
{
CollectionAssert.AreEqual(
new List<string>(),
new List<string> { "FR_300102" }.IntersectByGoupId(new List<string> { "FR_300101" }));
}
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
}