sharee.bike-App/TestShareeLib/Model/TestBikeCollectionFilter.cs

87 lines
2.8 KiB
C#
Raw Permalink Normal View History

2021-05-13 20:09:46 +02:00
using NUnit.Framework;
using System;
using System.Collections.Generic;
using TINK.Model;
using TINK.Model.Bike;
namespace TestTINKLib.Fixtures.ObjectTests.Bike
{
[TestFixture]
public class TestBikeCollectionFilter
{
[Test]
public void TestGetAtStation()
{
var coll = new BikeCollection(
2021-06-26 20:57:55 +02:00
new Dictionary<string, TINK.Model.Bike.BC.BikeInfo>
2021-05-13 20:09:46 +02:00
{
2022-04-25 22:15:15 +02:00
{"3", new TINK.Model.Bike.BC.BikeInfo("7", LockModel.ILockIt, "3" /* Stadion id */) },
{"7", new TINK.Model.Bike.BC.BikeInfo("8", LockModel.ILockIt, "12" /* Stadion id */) },
{"12", new TINK.Model.Bike.BC.BikeInfo("33", LockModel.ILockIt, "12" /* Stadion id */) }
2021-05-13 20:09:46 +02:00
});
Assert.AreEqual(
0,
2021-06-26 20:57:55 +02:00
BikeCollectionFilter.GetAtStation(null, "12").Count);
2021-05-13 20:09:46 +02:00
Assert.AreEqual(
0,
coll.GetAtStation(null).Count);
Assert.AreEqual(
0,
2021-06-26 20:57:55 +02:00
coll.GetAtStation("22").Count);
2021-05-13 20:09:46 +02:00
Assert.AreEqual(
1,
2021-06-26 20:57:55 +02:00
coll.GetAtStation("3").Count);
2021-05-13 20:09:46 +02:00
Assert.AreEqual(
2,
2021-06-26 20:57:55 +02:00
coll.GetAtStation("12").Count);
2021-05-13 20:09:46 +02:00
}
[Test]
public void TestGetLockIt_Null()
{
Assert.That(
BikeCollectionFilter.GetLockIt(null).Count,
Is.EqualTo(0));
}
[Test]
public void TestGetLockIt_NoLockIt()
{
// Holds no LockIt bikes
var coll = new BikeCollection(
2021-06-26 20:57:55 +02:00
new Dictionary<string, TINK.Model.Bike.BC.BikeInfo>
2021-05-13 20:09:46 +02:00
{
2022-04-25 22:15:15 +02:00
{"7", new TINK.Model.Bike.BC.BikeInfo("8", LockModel.ILockIt, "12" /* Stadion id */) },
{"12", new TINK.Model.Bike.BC.BikeInfo("33", LockModel.ILockIt, "12" /* Stadion id */) }
2021-05-13 20:09:46 +02:00
});
Assert.AreEqual(
0,
coll.GetLockIt().Count);
}
[Test]
public void TestGetLockIt()
{
// Holds no LockIt bike with matching station number.
var coll = new BikeCollection(
2021-06-26 20:57:55 +02:00
new Dictionary<string, TINK.Model.Bike.BC.BikeInfo>
2021-05-13 20:09:46 +02:00
{
2022-04-25 22:15:15 +02:00
{"7", new TINK.Model.Bike.BC.BikeInfo("8", LockModel.ILockIt, "12" /* Stadion id */) },
2021-06-26 20:57:55 +02:00
{"11", new TINK.Model.Bike.BluetoothLock.BikeInfo("33", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "12" /* Stadion id */) },
2022-04-25 22:15:15 +02:00
{"12", new TINK.Model.Bike.BC.BikeInfo("33", LockModel.ILockIt, "12" /* Stadion id */) }
2021-05-13 20:09:46 +02:00
});
Assert.AreEqual(
1,
coll.GetLockIt().Count);
}
}
}