mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 05:47:28 +02:00
Legacy testing lib added..
This commit is contained in:
parent
0167fc321f
commit
47ed05837e
118 changed files with 17505 additions and 0 deletions
21
TestTINKLib/Mocks/Services/GeolocationMock.cs
Normal file
21
TestTINKLib/Mocks/Services/GeolocationMock.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Services.Geolocation;
|
||||
using Xamarin.Essentials;
|
||||
|
||||
namespace TestTINKLib.Mocks.Services
|
||||
{
|
||||
public class GeolocationMock : IGeolocation
|
||||
{
|
||||
|
||||
public Task<Location> GetAsync(DateTime? timeStamp = null)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary> If true location data returned is simulated.</summary>
|
||||
public bool IsSimulation { get => true; }
|
||||
|
||||
public bool IsGeolcationEnabled => true;
|
||||
}
|
||||
}
|
86
TestTINKLib/Mocks/Services/LocksServiceMock.cs
Normal file
86
TestTINKLib/Mocks/Services/LocksServiceMock.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bike;
|
||||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Services.BluetoothLock;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
||||
namespace TestTINKLib.Mocks.Services
|
||||
{
|
||||
public class LocksServiceMock : ILocksService
|
||||
{
|
||||
/// <param name="connectTimeout">Timeout for connect operation of a single lock.</param>
|
||||
public async Task<IEnumerable<LockInfoTdo>> GetLocksStateAsync(IEnumerable<LockInfoAuthTdo> locksInfo, TimeSpan connectTimeout)
|
||||
{
|
||||
return await Task.FromResult(new List<LockInfoTdo>());
|
||||
}
|
||||
|
||||
/// <summary> Holds timeout values for series of connecting attemps to a lock or multiple locks. </summary>
|
||||
public ITimeOutProvider TimeOut { get; set; }
|
||||
|
||||
public void UpdateSimulation(BikeCollection bikes) {}
|
||||
|
||||
/// <summary> Opens lock.</summary>
|
||||
/// <param name="bike">Bike object to update.</param>
|
||||
public async Task<LockitLockingState?> OpenAsync(int lockId, byte[] copriKey) => await Task.FromResult(LockitLockingState.Open);
|
||||
|
||||
/// <summary> Closes lock.</summary>
|
||||
/// <param name="bike">Bike object to update.</param>
|
||||
public async Task<LockitLockingState?> CloseAsync(int lockId, byte[] copriKey) => await Task.FromResult(LockitLockingState.Closed);
|
||||
|
||||
/// <summary> Gets the state of a bike. </summary>
|
||||
/// <param name="lockId">Id of lockId to get state for.</param>
|
||||
/// <returns></returns>
|
||||
public async Task<LockitLockingState?> GetState(string lockId) => await Task.FromResult((LockitLockingState?)null);
|
||||
|
||||
/// <summary> Connects to lock.</summary>
|
||||
/// <param name="authInfo"> Info required to connect to lock.</param>
|
||||
/// <param name="connectTimeout">Timeout for connect operation.</param>
|
||||
public async Task<LockInfoTdo> 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());
|
||||
}
|
||||
|
||||
/// <summary> Set sound settings.</summary>
|
||||
/// <param name="lockId">Id of lock to set sound settings.</param>
|
||||
public async Task<bool> SetSoundAsync(int lockId, SoundSettings settings)
|
||||
{
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
/// <summary> Gets battery percentage.</summary>
|
||||
/// <param name="lockId">Id of lock to get info for.</param>
|
||||
public Task<double> GetBatteryPercentageAsync(int lockId)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary> Sets whether alarm is on or off.</summary>
|
||||
/// <param name="lockId">Id of lock to get info from.</param>
|
||||
public async Task SetIsAlarmOffAsync(int lockId, bool activated)
|
||||
{
|
||||
await Task.FromResult(true);
|
||||
}
|
||||
|
||||
/// <summary> Gets whether alarm is on or off.</summary>
|
||||
/// <param name="lockId">Id of lock to get info for.</param>
|
||||
public async Task<bool> GetIsAlarmOffAsync(int lockId)
|
||||
{
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
/// <summary>Gets a lock by bike Id.</summary>
|
||||
/// <param name="bikeId"></param>
|
||||
/// <returns>Lock object</returns>
|
||||
public ILockService this[int bikeId]
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Task<LockingState> DisconnectAsync(int bikeId, Guid bikeGuid) => throw new NotSupportedException();
|
||||
}
|
||||
}
|
41
TestTINKLib/Mocks/Services/PermissionsMock.cs
Normal file
41
TestTINKLib/Mocks/Services/PermissionsMock.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using Plugin.Permissions;
|
||||
using Plugin.Permissions.Abstractions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestTINKLib.Mocks.Services
|
||||
{
|
||||
public class PermissionsMock : IPermissions
|
||||
{
|
||||
public async Task<PermissionStatus> CheckPermissionStatusAsync<T>() where T : BasePermission, new()
|
||||
{
|
||||
return await Task.FromResult(Plugin.Permissions.Abstractions.PermissionStatus.Granted);
|
||||
}
|
||||
|
||||
public Task<PermissionStatus> CheckPermissionStatusAsync(Permission permission)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool OpenAppSettings()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<PermissionStatus> RequestPermissionAsync<T>() where T : BasePermission, new()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<Dictionary<Permission, PermissionStatus>> RequestPermissionsAsync(params Permission[] permissions)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<bool> ShouldShowRequestPermissionRationaleAsync(Permission permission)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue