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 { "KN_300102", "Bla_XXX", "FR_777" }), Is.EqualTo(new List { "300102", "777" }).AsCollection); } [Test] public void TestToBikeCategoryEmpty() { Assert.That( IntersectGroupFilterHelper.ToBikeCategory(new List { "KN_" }).Count(), Is.EqualTo(0)); } [Test] public void TestIntersectByGoupId() { Assert.That( new List { "FR_300101", "XY_777" }.IntersectByGoupId(new List { "XY_776", "KN_300101" }), Is.EqualTo(new List { "FR_300101" }).AsCollection); } [Test] public void TestIntersectByGoupId_Empty() { Assert.That( new List { "FR_300102" }.IntersectByGoupId(new List { "FR_300101" }), Is.EqualTo(new List()).AsCollection); } [Test] public void TestContainsGroupId_True() { Assert.That( new List { "FR_300101", "XY_777" }.ContainsGroupId("KN_300101"), Is.True); } [Test] public void TestContainsGroupId_False() { Assert.That( new List { "FR_300101", "XY_777" }.ContainsGroupId("XY_776"), Is.False); } } }