mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-16 15:16:34 +01:00
54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using System;
|
|
using NSubstitute;
|
|
using NUnit.Framework;
|
|
using TINK.Model.Connector;
|
|
using TINK.Model.Device;
|
|
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));
|
|
}
|
|
|
|
[Test]
|
|
public void TestGetSmartDeviceParameters()
|
|
{
|
|
var sd = Substitute.For<ISmartDevice>();
|
|
sd.Manufacturer.Returns("Färphone");
|
|
sd.Model.Returns("Fön");
|
|
sd.Platform.Returns(Xamarin.Essentials.DevicePlatform.Create("Android"));
|
|
sd.VersionText.Returns("ß1");
|
|
sd.Identifier.Returns("ß9");
|
|
|
|
Assert.That(
|
|
sd.GetSmartDeviceParameters(),
|
|
Is.EqualTo("&user_device_manufacturer=F%C3%A4rphone&user_device_model=F%C3%B6n&user_device_platform=Android&user_device_version=%C3%9F1&user_device_id=%C3%9F9"));
|
|
|
|
}
|
|
}
|
|
}
|