2023-01-18 14:22:51 +01:00
|
|
|
using System;
|
2021-07-12 21:31:46 +02:00
|
|
|
using System.Collections.Generic;
|
2022-08-30 15:42:25 +02:00
|
|
|
using System.Linq;
|
2021-07-12 21:31:46 +02:00
|
|
|
using NUnit.Framework;
|
2022-08-30 15:42:25 +02:00
|
|
|
using TINK.Model.Bikes;
|
|
|
|
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
|
|
|
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
|
2021-07-12 21:31:46 +02:00
|
|
|
using TINK.Services.BluetoothLock;
|
|
|
|
using TINK.Services.BluetoothLock.Tdo;
|
|
|
|
|
|
|
|
namespace TestTINKLib.Fixtures.ObjectTests.Service.LockService
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
[TestFixture]
|
|
|
|
public class TestLockServiceSimulation
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void TestUpdateSimulationInstance_Update()
|
|
|
|
{
|
|
|
|
var service = new LocksServiceInReach();
|
2021-07-12 21:31:46 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
var bikes = new BikeCollection(new Dictionary<string, TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo>()
|
|
|
|
{
|
2023-08-31 12:31:38 +02:00
|
|
|
{ "42", new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("42", LockModel.ILockIt), new DriveMutable(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 1, new Guid(),new byte[] { 1, 4 }, new byte[] { 3, 4 }, new byte[] { 3, 4 }, DateTime.Now, "a@b", "1" , null /*operator uri*/) },
|
|
|
|
{ "43", new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("43", LockModel.ILockIt), new DriveMutable(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 3, new Guid(),new byte[] { 4, 4 }, new byte[] { 4, 7 }, new byte[] { 5, 4 }, DateTime.Now, "c@b", "1" , null /*operator uri*/) }
|
2022-09-06 16:08:19 +02:00
|
|
|
}
|
|
|
|
);
|
2021-07-12 21:31:46 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
if (service is ILocksServiceFake serviceFake)
|
|
|
|
{
|
|
|
|
serviceFake.UpdateSimulation(bikes);
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
Assert.AreEqual(2, service.GetLocksStateAsync(new List<LockInfoAuthTdo>(), new TimeSpan(0, 0, 3)).Result.Count());
|
|
|
|
}
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
}
|