Version 3.0.356

This commit is contained in:
Oliver Hauff 2022-12-27 21:08:09 +01:00
parent d23aff6daf
commit 5980410182
48 changed files with 242 additions and 362 deletions

View file

@ -0,0 +1,36 @@
using System;
using NUnit.Framework;
using TINK.Model.Connector;
using TINK.Repository.Request;
namespace TestShareeLib.Repository.Request
{
[TestFixture]
public class TestRequestBuilderHelper
{
[Test]
public void TestGetLockStateNull()
=> Assert.That(
RequestBuilderHelper.GetLockState(null),
Is.Null);
[Test]
public void TestGetLockState([Values] LockingAction action)
{
switch (action)
{
case LockingAction.Open:
case LockingAction.Close:
break;
default:
throw new ArgumentException("Tests need possibly exended.");
}
Assert.That(
RequestBuilderHelper.GetLockState(action),
Is.EqualTo(action == LockingAction.Open ? lock_state.unlocking : lock_state.locking));
}
}
}

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Net;
using NUnit.Framework;
using TINK.Model.Connector;
using TINK.Repository.Exception;
using TINK.Repository.Request;
@ -117,18 +118,35 @@ namespace TestShareeLib.Repository.Request
public void TestDoBook()
{
Assert.AreEqual(
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied&lock_state=unlocked&voltage=33.21",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), 33.21));
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied&lock_state=unlocking&voltage=33.21",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), 33.21, LockingAction.Open));
}
[Test]
public void TestDoBookNoBatery()
{
Assert.AreEqual(
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied&lock_state=unlocked",
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), double.NaN));
}
[Test]
public void TestDoBookActionNone()
{
Assert.AreEqual(
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), double.NaN));
}
/// <summary> Hypothetical scenario.</summary>
[Test]
public void TestDoBookActionClose()
{
Assert.AreEqual(
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied&lock_state=locking",
new RequestBuilderLoggedIn("123", null /*UI language */, "456").DoBook("42", new Guid("0000f00d-1212-efde-1523-785fef13d123"), double.NaN, LockingAction.Close));
}
[Test]
public void TestBookAndStartOpening()
=> Assert.That(