Version 3.0.290

This commit is contained in:
Oliver Hauff 2022-04-10 17:38:34 +02:00
parent af3c20ea1c
commit ad3cdbcadf
231 changed files with 14555 additions and 7798 deletions

View file

@ -10,7 +10,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
public void TestCtor()
{
Assert.AreEqual(
LockingState.Disconnected,
LockingState.UnknownDisconnected,
new LockInfo.Builder { Id = 123 }.Build().State);
Assert.AreEqual(

View file

@ -14,7 +14,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
public void TestUpdateById_State()
{
var locksInfo = new List<LockInfo> {
new LockInfo.Builder { Id = 12, Seed = new byte[] { 3, 5 }, UserKey = new byte[] {2, 1 }, State = LockingState.Unknown }.Build(),
new LockInfo.Builder { Id = 12, Seed = new byte[] { 3, 5 }, UserKey = new byte[] {2, 1 }, State = LockingState.UnknownFromHardwareError }.Build(),
new LockInfo.Builder { Id = 14, Seed = new byte[] { 3, 1 }, UserKey = new byte[] {2, 7 }, State = LockingState.Open }.Build(),
new LockInfo.Builder { Id = 3, Seed = new byte[] { 1, 5 }, UserKey = new byte[] {2, 9 }, State = LockingState.Closed }.Build(),
};
@ -34,7 +34,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
public void TestUpdateById_Guid()
{
var locksInfo = new List<LockInfo> {
new LockInfo.Builder { Id = 12, Seed = new byte[] { 3, 5 }, UserKey = new byte[] {2, 1 }, State = LockingState.Unknown }.Build(),
new LockInfo.Builder { Id = 12, Seed = new byte[] { 3, 5 }, UserKey = new byte[] {2, 1 }, State = LockingState.UnknownFromHardwareError }.Build(),
new LockInfo.Builder { Id = 14, Seed = new byte[] { 3, 1 }, UserKey = new byte[] {2, 7 }, State = LockingState.Open }.Build(),
new LockInfo.Builder { Id = 3, Seed = new byte[] { 1, 5 }, UserKey = new byte[] {2, 9 }, State = LockingState.Closed }.Build(),
};

View file

@ -5,15 +5,14 @@ using TINK.Model.Connector;
using TINK.Model.Services.CopriApi.ServerUris;
using TINK.Services;
using NSubstitute;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Services.BluetoothLock;
using TINK.Model.Device;
using TINK.Model.User.Account;
using Plugin.Permissions.Abstractions;
using TestShareeLib.Repository;
using TestFramework.Repository;
using TINK.Repository;
using TINK.Services.Permissions;
using Plugin.BLE.Abstractions.Contracts;
namespace TestTINKLib.Fixtures.UseCases.Logout
{
@ -27,7 +26,7 @@ namespace TestTINKLib.Fixtures.UseCases.Logout
var locksService = Substitute.For<ILocksService>();
var device = Substitute.For<ISmartDevice>();
var specialFolder = Substitute.For<ISpecialFolder>();
var permissions = Substitute.For<IPermissions>();
var permissions = Substitute.For<ILocationPermission>();
var account = Substitute.For<IAccount>();
accountStore.Load().Returns(account);
@ -42,17 +41,18 @@ namespace TestTINKLib.Fixtures.UseCases.Logout
activeGeolocationService: "NotRelevantActiveGeoloactionServiceName",
activeUri: new Uri(CopriServerUriList.TINK_DEVEL)),
accountStore,
(isConnected, uri, sessionCookie, mail, expiresAfter) => string.IsNullOrEmpty(sessionCookie)
? new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001())
: new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
locksService,
device,
specialFolder,
null, // Cipher
permissions,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => string.IsNullOrEmpty(sessionCookie)
? new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001())
: new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: permissions,
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: locksService, // Cipher
device: device,
specialFolder: specialFolder,
cipher: null,
currentVersion: new Version(3, 2, 0, 115),
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to

View file

@ -5,14 +5,15 @@ using TINK.Model.Connector;
using TINK.Model.Services.CopriApi.ServerUris;
using TINK.Services;
using NSubstitute;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Services.BluetoothLock;
using TINK.Model.Device;
using TINK.Model.User.Account;
using Plugin.Permissions.Abstractions;
using System.Threading.Tasks;
using TestFramework.Repository;
using TINK.Repository;
using TINK.Services.Permissions;
using Plugin.BLE.Abstractions.Contracts;
namespace TestShareeLib.UseCases.Login
{
@ -26,7 +27,7 @@ namespace TestShareeLib.UseCases.Login
var locksService = Substitute.For<ILocksService>();
var device = Substitute.For<ISmartDevice>();
var specialFolder = Substitute.For<ISpecialFolder>();
var permissions = Substitute.For<IPermissions>();
var permissions = Substitute.For<ILocationPermission>();
// No user logged in is initial state to verify.
var tinkApp = new TinkApp(
@ -35,17 +36,18 @@ namespace TestShareeLib.UseCases.Login
activeGeolocationService: "NotRelevantActiveGeoloactionServiceName",
activeUri: new Uri(CopriServerUriList.TINK_DEVEL)),
accountStore,
(isConnected, uri, sessionCookie, mail, expiresAfter) => string.IsNullOrEmpty(sessionCookie)
? new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001())
: new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
locksService,
device,
specialFolder,
null, // Cipher
permissions,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => string.IsNullOrEmpty(sessionCookie)
? new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001())
: new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: permissions,
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: locksService, // Cipher
device: device,
specialFolder: specialFolder,
cipher: null,
currentVersion: new Version(3, 2, 0, 115),
lastVersion: new Version(3, 0, 173) /* Current app version. Must be larger or equal 3.0.173 to lastVersion*/);