sharee.bike-App/SharedBusinessLogic.Tests/Services/BluetoothLock/TestLockServiceSimulation.cs

37 lines
1.6 KiB
C#
Raw Normal View History

2024-04-09 12:53:23 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using ShareeBike.Model.Bikes;
using ShareeBike.Model.Bikes.BikeInfoNS.BikeNS;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS;
using ShareeBike.Services.BluetoothLock;
using ShareeBike.Services.BluetoothLock.Tdo;
namespace SharedBusinessLogic.Tests.Fixtures.ObjectTests.Service.LockService
{
[TestFixture]
public class TestLockServiceSimulation
{
[Test]
public void TestUpdateSimulationInstance_Update()
{
var service = new LocksServiceInReach();
var bikes = new BikeCollection(new Dictionary<string, ShareeBike.Model.Bikes.BikeInfoNS.BC.BikeInfo>()
{
{ "42", new ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.Bike("42", LockModel.ILockIt), new DriveMutable(), ShareeBike.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 ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.Bike("43", LockModel.ILockIt), new DriveMutable(), ShareeBike.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*/) }
}
);
if (service is ILocksServiceFake serviceFake)
{
serviceFake.UpdateSimulation(bikes);
}
Assert.That(service.GetLocksStateAsync(new List<LockInfoAuthTdo>(), new TimeSpan(0, 0, 3)).Result.Count(), Is.EqualTo(2));
}
}
}