mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +02:00
Version 3.0.356
This commit is contained in:
parent
d23aff6daf
commit
5980410182
48 changed files with 242 additions and 362 deletions
36
TestShareeLib/Repository/Request/TestRequestBuilderHelper.cs
Normal file
36
TestShareeLib/Repository/Request/TestRequestBuilderHelper.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue