2022-08-30 15:42:25 +02:00
|
|
|
|
using System;
|
2021-05-13 17:07:16 +02:00
|
|
|
|
using System.Collections.Generic;
|
2022-08-30 15:42:25 +02:00
|
|
|
|
using NUnit.Framework;
|
2021-05-13 17:07:16 +02:00
|
|
|
|
|
2024-04-09 12:53:23 +02:00
|
|
|
|
namespace ShareeBike.Services.BluetoothLock
|
2021-05-13 17:07:16 +02:00
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestTimeOutProvider
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCtor()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(new TimeOutProvider().MultiConnect.TotalSeconds, Is.EqualTo(5), "Unexpected bluetooth default timeout detected.");
|
2021-05-13 17:07:16 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).MultiConnect.TotalSeconds, Is.EqualTo(4));
|
|
|
|
|
}
|
2021-05-13 17:07:16 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetSingleConnect()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(1).TotalSeconds, Is.EqualTo(4));
|
|
|
|
|
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(2).TotalSeconds, Is.EqualTo(8));
|
|
|
|
|
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(3).TotalSeconds, Is.EqualTo(12));
|
|
|
|
|
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(4).TotalSeconds, Is.EqualTo(16));
|
|
|
|
|
Assert.That(new TimeOutProvider(new List<TimeSpan>() { new TimeSpan(0, 0, 4) }).GetSingleConnect(5).TotalSeconds, Is.EqualTo(16));
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-13 17:07:16 +02:00
|
|
|
|
}
|