mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-20 12:06:29 +02:00
Legacy testing lib added..
This commit is contained in:
parent
0167fc321f
commit
47ed05837e
118 changed files with 17505 additions and 0 deletions
|
@ -0,0 +1,124 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using TINK.Repository.Request;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Model.Repository.Request
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestRequestBuilderLoggedIn
|
||||
{
|
||||
[Test]
|
||||
public void TestUpateLockingStateGeolocationIsNull()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", null, lock_state.locked, 15.03),
|
||||
Is.EqualTo("request=booking_update&bike=12&lock_state=locked&voltage=15.03&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpateLockingStateGeolocationIsNullBatteryPercentageIsNAN()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", null, lock_state.locked, double.NaN),
|
||||
Is.EqualTo("request=booking_update&bike=12&lock_state=locked&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpateLockingStateGeolocation_AccuraycyNull()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), lock_state.locked, 12),
|
||||
Is.EqualTo("request=booking_update&bike=12&gps=21,17&gps_age=0.07&lock_state=locked&voltage=12&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpateLockingStateGeolocation_AccuraycyNullBatteryPercentageIsNAN()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), lock_state.locked, double.NaN),
|
||||
Is.EqualTo("request=booking_update&bike=12&gps=21,17&gps_age=0.07&lock_state=locked&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpateLockingStateGeolocation()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", new LocationDto.Builder { Latitude = 21, Longitude = 17, Accuracy = 5.7, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), lock_state.locked, 98),
|
||||
Is.EqualTo("request=booking_update&bike=12&gps=21,17&gps_accuracy=5.7&gps_age=0.07&lock_state=locked&voltage=98&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDoReturnGeolocationIsNull()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.DoReturn("12", null, null),
|
||||
Is.EqualTo("request=booking_update&bike=12&authcookie=MySessionCookieMyMeranctIt&state=available&lock_state=locked"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDoReturnGeolocation_AccuraycyNull()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.DoReturn(
|
||||
"12",
|
||||
new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(),
|
||||
null),
|
||||
Is.EqualTo("request=booking_update&bike=12&authcookie=MySessionCookieMyMeranctIt&state=available&gps=21,17&gps_age=0.07&lock_state=locked"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDoReturnGeolocation()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.DoReturn(
|
||||
"12",
|
||||
new LocationDto.Builder { Latitude = 21, Longitude = 17, Accuracy = 5.7, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(),
|
||||
null),
|
||||
Is.EqualTo("request=booking_update&bike=12&authcookie=MySessionCookieMyMeranctIt&state=available&gps=21,17&gps_accuracy=5.7&gps_age=0.07&lock_state=locked"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDoSubmitFeedback_Ok()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.DoSubmitFeedback("Radl22"),
|
||||
Is.EqualTo("request=user_feedback&bike=Radl22&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDoSubmitFeedback_BikeBroken()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.DoSubmitFeedback("Cycle33", isBikeBroken: true),
|
||||
Is.EqualTo("request=user_feedback&bike=Cycle33&bike_broken=1&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDoSubmitFeedback_Message()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.DoSubmitFeedback("Mühle", "Uno due tre"),
|
||||
Is.EqualTo("request=user_feedback&bike=Mühle&message=Uno+due+tre&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDoSubmitFeedback_ErrorMessage()
|
||||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.DoSubmitFeedback("bike12","Uno due tre", true),
|
||||
Is.EqualTo("request=user_feedback&bike=bike12&bike_broken=1&message=Uno+due+tre&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue