using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ShareeBike.Model.Bikes;
using ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock;
using ShareeBike.Services.BluetoothLock;
using ShareeBike.Services.BluetoothLock.Tdo;
namespace SharedBusinessLogic.Tests.Framework.Services.BluetoothLock
{
public class LocksServiceMock : ILocksService
{
/// Timeout for connect operation of a single lock.
public async Task> GetLocksStateAsync(IEnumerable locksInfo, TimeSpan connectTimeout)
{
return await Task.FromResult(new List());
}
/// Holds timeout values for series of connecting attempts to a lock or multiple locks.
public ITimeOutProvider TimeOut { get; set; }
public void UpdateSimulation(BikeCollection bikes) { }
/// Opens lock.
/// Bike object to update.
public async Task OpenAsync(int lockId, byte[] copriKey) => await Task.FromResult(LockitLockingState.Open);
/// Closes lock.
/// Bike object to update.
public async Task CloseAsync(int lockId, byte[] copriKey) => await Task.FromResult(LockitLockingState.Closed);
/// Gets the state of a bike.
/// Id of lockId to get state for.
///
public async Task GetState(string lockId) => await Task.FromResult((LockitLockingState?)null);
/// Connects to lock.
/// Info required to connect to lock.
/// Timeout for connect operation.
public async Task ConnectAsync(LockInfoAuthTdo authInfo, TimeSpan connectTimeout)
{
return await Task.FromResult(new LockInfoTdo.Builder { Id = 12, Guid = new System.Guid("00000000-0000-0000-0000-000000000042"), State = null }.Build());
}
/// Set sound settings.
/// Id of lock to set sound settings.
public async Task SetSoundAsync(int lockId, SoundSettings settings)
{
return await Task.FromResult(true);
}
/// Gets battery percentage.
/// Id of lock to get info for.
public Task GetBatteryPercentageAsync(int lockId)
{
throw new NotSupportedException();
}
/// Sets whether alarm is on or off.
/// Id of lock to get info from.
public async Task SetIsAlarmOffAsync(int lockId, bool activated)
{
await Task.FromResult(true);
}
/// Gets whether alarm is on or off.
/// Id of lock to get info for.
public async Task GetIsAlarmOffAsync(int lockId)
{
return await Task.FromResult(true);
}
/// Gets a lock by bike Id.
///
/// Lock object
public ILockService this[int bikeId]
{
get
{
return null;
}
}
public Task DisconnectAsync(int bikeId, Guid bikeGuid) => throw new NotSupportedException();
}
}