mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-22 12:56:29 +02:00
Initial version
This commit is contained in:
parent
41b618cb27
commit
e4fb48f6ab
24 changed files with 4387 additions and 0 deletions
53
TestShareeLib/Model/Bike/BluetoothLock/TestLockInfoHelper.cs
Normal file
53
TestShareeLib/Model/Bike/BluetoothLock/TestLockInfoHelper.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestLockInfoHelper
|
||||
{
|
||||
[Test]
|
||||
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 = 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(),
|
||||
};
|
||||
|
||||
var locksInfoTdo = new List<LockInfoTdo> {
|
||||
new LockInfoTdo.Builder { Id =14, State = LockitLockingState.Closed}.Build()
|
||||
};
|
||||
|
||||
var resultList = locksInfo.UpdateById(locksInfoTdo);
|
||||
|
||||
var result = resultList.FirstOrDefault(x => x.Id == 14);
|
||||
Assert.NotNull(result, "Target element was removed.");
|
||||
Assert.AreEqual(LockingState.Closed, result.State);
|
||||
}
|
||||
|
||||
[Test]
|
||||
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 = 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(),
|
||||
};
|
||||
|
||||
var locksInfoTdo = new List<LockInfoTdo> {
|
||||
new LockInfoTdo.Builder { Id =14, Guid = new System.Guid("00000000-0000-0000-0000-e57e6b9aee16"), State = LockitLockingState.Open}.Build()
|
||||
};
|
||||
|
||||
var resultList = locksInfo.UpdateById(locksInfoTdo);
|
||||
|
||||
var result = resultList.FirstOrDefault(x => x.Id == 14);
|
||||
Assert.NotNull(result, "Target element was removed.");
|
||||
Assert.AreEqual(new Guid("00000000-0000-0000-0000-e57e6b9aee16"), result.Guid);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue