sharee.bike-App/SharedBusinessLogic.Tests/Model/Connector/Filter/TestIntersectGroupFilterHelper.cs
2024-04-09 12:53:23 +02:00

72 lines
1.7 KiB
C#

using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using ShareeBike.Model.Connector.Filter;
using NUnit.Framework.Legacy;
namespace SharedBusinessLogic.Tests.Model.Connector.Filter
{
[TestFixture]
public class TestIntersectGroupFilterHelper
{
[Test]
public void TestGetBikeCategory()
{
Assert.That(
"Fr_300102".GetBikeCategory(), Is.EqualTo("300102").AsCollection);
}
[Test]
public void TestGetBikeCategoryEmpty()
{
Assert.That(
"CAD_".GetBikeCategory(), Is.EqualTo("").AsCollection);
}
[Test]
public void TestToBikeCategory()
{
Assert.That(
IntersectGroupFilterHelper.ToBikeCategory(new List<string> { "KN_300102", "Bla_XXX", "FR_777" }), Is.EqualTo(new List<string> { "300102", "777" }).AsCollection);
}
[Test]
public void TestToBikeCategoryEmpty()
{
Assert.That(
IntersectGroupFilterHelper.ToBikeCategory(new List<string> { "KN_" }).Count(),
Is.EqualTo(0));
}
[Test]
public void TestIntersectByGoupId()
{
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);
}
[Test]
public void TestIntersectByGoupId_Empty()
{
Assert.That(
new List<string> { "FR_300102" }.IntersectByGoupId(new List<string> { "FR_300101" }), Is.EqualTo(new List<string>()).AsCollection);
}
[Test]
public void TestContainsGroupId_True()
{
Assert.That(
new List<string> { "FR_300101", "XY_777" }.ContainsGroupId("KN_300101"),
Is.True);
}
[Test]
public void TestContainsGroupId_False()
{
Assert.That(
new List<string> { "FR_300101", "XY_777" }.ContainsGroupId("XY_776"),
Is.False);
}
}
}