2022-09-20 13:51:55 +02:00
using System ;
2021-08-01 17:24:15 +02:00
using System.Collections.Generic ;
2022-09-22 20:58:30 +02:00
using System.Net ;
2023-01-18 14:22:51 +01:00
using NSubstitute ;
2022-08-30 15:42:25 +02:00
using NUnit.Framework ;
2022-12-27 21:08:09 +01:00
using TINK.Model.Connector ;
2023-01-18 14:22:51 +01:00
using TINK.Model.Device ;
2021-07-12 21:31:46 +02:00
using TINK.Repository.Exception ;
using TINK.Repository.Request ;
2021-08-01 17:24:15 +02:00
namespace TestShareeLib.Repository.Request
2021-07-12 21:31:46 +02:00
{
2022-09-06 16:08:19 +02:00
[TestFixture]
public class TestRequestBuilderLoggedIn
{
[Test]
public void TestDoAuthorize ( )
{
Assert . Throws < CallNotRequiredException > ( ( ) = > new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . DoAuthorization ( "abc@cde" , "+?" , "789" ) ) ;
}
[Test]
public void TestDoAuthout ( )
{
Assert . AreEqual (
2023-01-18 14:22:51 +01:00
"request=authout&authcookie=K%C3%A4ksM%C3%B6rchantId&lang=%C3%B6e" ,
new RequestBuilderLoggedIn ( "MörchantId" , "öe" /* fictive UI language */ , "Käks" ) . DoAuthout ( ) ) ;
2022-09-06 16:08:19 +02:00
}
[Test]
public void TestDoAuthoutLangDe ( )
= > Assert . That (
new RequestBuilderLoggedIn ( "123" , "de" , "456" ) . DoAuthout ( ) ,
Is . EqualTo ( "request=authout&authcookie=456123&lang=de" ) ) ;
[Test]
public void TestGetBikesAvailable ( )
{
Assert . AreEqual (
"request=bikes_available&system=all&authcookie=456123" ,
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . GetBikesAvailable ( ) ) ;
}
[Test]
public void TestGetBikesAvailable_Null ( )
{
Assert . Throws < ArgumentException > ( ( ) = >
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , null ) . GetBikesAvailable ( ) ) ;
Assert . Throws < ArgumentException > ( ( ) = >
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , string . Empty ) . GetBikesAvailable ( ) ) ;
}
[Test]
public void TestGetBikesOccupied ( )
{
Assert . AreEqual (
"request=user_bikes_occupied&system=all&genkey=1&authcookie=456123" ,
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . GetBikesOccupied ( ) ) ;
}
[Test]
public void TestGetBikesOccupied_Null ( )
{
Assert . Throws < ArgumentException > ( ( ) = >
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , null ) . GetBikesOccupied ( ) ) ;
Assert . Throws < ArgumentException > ( ( ) = >
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "" ) . GetBikesOccupied ( ) ) ;
}
[Test]
public void TestGetStations ( )
{
Assert . AreEqual (
"request=stations_available&authcookie=456123" ,
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . GetStations ( ) ) ;
}
2023-02-22 14:03:35 +01:00
[Test]
public void TestGetStationsSmartDeviceManufacturer ( )
{
var sd = Substitute . For < ISmartDevice > ( ) ;
sd . Manufacturer . Returns ( "Färphone" ) ;
Assert . AreEqual (
"request=stations_available&authcookie=456123&user_device_manufacturer=F%C3%A4rphone" ,
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" , sd ) . GetStations ( ) ) ;
}
2022-09-06 16:08:19 +02:00
[Test]
public void TestGetStations_Null ( )
{
Assert . Throws < ArgumentException > ( ( ) = >
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , string . Empty ) . GetStations ( ) ) ;
Assert . Throws < ArgumentException > ( ( ) = >
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , null ) . GetStations ( ) ) ;
}
[Test]
public void TestDoReserve ( )
{
Assert . AreEqual (
2023-01-18 14:22:51 +01:00
"request=booking_request&bike=M%C3%BChleNr42&authcookie=456123" ,
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . DoReserve ( "MühleNr42" ) ) ;
2022-09-06 16:08:19 +02:00
}
2023-02-22 14:03:35 +01:00
[Test]
public void TestDoReserveSmartDeviceManufacturer ( )
{
var sd = Substitute . For < ISmartDevice > ( ) ;
sd . Manufacturer . Returns ( "Färphone" ) ;
Assert . That (
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" , sd ) . DoReserve ( "MühleNr42" ) ,
Is . EqualTo ( "request=booking_request&bike=M%C3%BChleNr42&authcookie=456123&user_device_manufacturer=F%C3%A4rphone" ) ) ;
}
2022-09-06 16:08:19 +02:00
[Test]
public void TestDoCancelReservation ( )
{
Assert . AreEqual (
"request=booking_cancel&bike=42&authcookie=456123" ,
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . DoCancelReservation ( "42" ) ) ;
}
[Test]
public void TestCalculateAuthParameters ( )
= > Assert . That (
new RequestBuilderLoggedIn ( "123" , "zh" , "456" ) . CalculateAuthParameters ( "42" ) ,
Is . EqualTo ( "request=booking_update&bike=42&authcookie=456123&genkey=1&lang=zh" ) ) ;
[Test]
public void TestStartReturningBike ( )
= > Assert . That (
new RequestBuilderLoggedIn ( "123" , "zh" , "456" ) . StartReturningBike ( "42" ) ,
Is . EqualTo ( "request=booking_update&bike=42&lock_state=locking&authcookie=456123&lang=zh" ) ) ;
[Test]
public void TestDoBook ( )
{
Assert . AreEqual (
2022-12-27 21:08:09 +01:00
"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 ) ) ;
2022-09-06 16:08:19 +02:00
}
[Test]
public void TestDoBookNoBatery ( )
{
Assert . AreEqual (
2022-12-27 21:08:09 +01:00
"request=booking_update&bike=42&authcookie=456123&Ilockit_GUID=0000f00d-1212-efde-1523-785fef13d123&state=occupied" ,
2022-09-06 16:08:19 +02:00
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . DoBook ( "42" , new Guid ( "0000f00d-1212-efde-1523-785fef13d123" ) , double . NaN ) ) ;
}
2022-12-27 21:08:09 +01:00
[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 ) ) ;
}
2022-09-06 16:08:19 +02:00
[Test]
public void TestBookAndStartOpening ( )
= > Assert . That (
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . BookAvailableAndStartOpening ( "42" ) ,
Is . EqualTo ( "request=booking_request&bike=42&authcookie=456123&state=occupied&lock_state=unlocking" ) ) ;
2023-02-22 14:03:35 +01:00
[Test]
public void TestBookAndStartOpeningSmartDeviceManufacturer ( )
{
var sd = Substitute . For < ISmartDevice > ( ) ;
sd . Manufacturer . Returns ( "Färphone" ) ;
Assert . That (
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" , sd ) . BookAvailableAndStartOpening ( "42" ) ,
Is . EqualTo ( "request=booking_request&bike=42&authcookie=456123&state=occupied&lock_state=unlocking&user_device_manufacturer=F%C3%A4rphone" ) ) ;
}
2022-09-06 16:08:19 +02:00
[Test]
public void TestBookReservedAndStartOpening ( )
= > Assert . That (
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . BookReservedAndStartOpening ( "42" ) ,
Is . EqualTo ( "request=booking_update&bike=42&authcookie=456123&state=occupied&lock_state=unlocking" ) ) ;
[Test]
public void TestReturnAndStartClosing ( )
{
Assert . That (
2023-02-22 14:03:35 +01:00
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" ) . ReturnAndStartClosing ( "42" ) ,
2022-09-06 16:08:19 +02:00
Is . EqualTo ( "request=booking_update&bike=42&authcookie=456123&state=available&lock_state=locking" ) ) ;
}
2023-02-22 14:03:35 +01:00
[Test]
public void TestReturnAndStartClosingSmartDeviceManufacturer ( )
{
var sd = Substitute . For < ISmartDevice > ( ) ;
sd . Manufacturer . Returns ( "Färphone" ) ;
Assert . That (
new RequestBuilderLoggedIn ( "123" , null /*UI language */ , "456" , sd ) . ReturnAndStartClosing ( "42" ) ,
Is . EqualTo ( "request=booking_update&bike=42&authcookie=456123&state=available&lock_state=locking&user_device_manufacturer=F%C3%A4rphone" ) ) ;
}
2022-09-06 16:08:19 +02:00
[Test]
public void TestDoSubmitMiniSurvey ( )
{
Assert . That (
new RequestBuilderLoggedIn ( "Merchy" , null /*UI language */ , "Keksi" ) . DoSubmitMiniSurvey ( new Dictionary < string , string > { { "q1" , "opt5" } , { "q2" , "opt4" } , { "q3" , "der Freitext" } } ) ,
Is . EqualTo ( "request=user_minianswer&q1=opt5&q2=opt4&q3=der+Freitext&authcookie=KeksiMerchy" ) ) ;
}
[Test]
public void TestDoSubmitMiniSurveyNull ( )
{
Assert . That (
new RequestBuilderLoggedIn ( "Merchy" , null /*UI language */ , "Keksi" ) . DoSubmitMiniSurvey ( null ) ,
Is . EqualTo ( "request=user_minianswer&authcookie=KeksiMerchy" ) ) ;
}
[Test]
public void TestDoSubmitMiniSurveyEmptyDict ( )
{
Assert . That (
new RequestBuilderLoggedIn ( "Merchy" , null /*UI language */ , "Keksi" ) . DoSubmitMiniSurvey ( new Dictionary < string , string > ( ) ) ,
Is . EqualTo ( "request=user_minianswer&authcookie=KeksiMerchy" ) ) ;
}
[Test]
public void TestDoSubmitMiniSurveyFilterInvalidEntries ( )
{
Assert . That (
new RequestBuilderLoggedIn ( "Merchy" , null /*UI language */ , "Keksi" ) . DoSubmitMiniSurvey ( new Dictionary < string , string > { { "q1" , "opt5" } , { "" , "opt99" } , { "q99" , "" } , { "q2" , "opt4" } , { "q3" , "der Freitext" } } ) ,
Is . EqualTo ( "request=user_minianswer&q1=opt5&q2=opt4&q3=der+Freitext&authcookie=KeksiMerchy" ) ) ;
}
[Test]
2023-07-04 11:06:38 +02:00
public void TestUpdateLockingStateGeolocationIsNull ( )
2022-09-06 16:08:19 +02:00
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
2023-07-04 11:06:38 +02:00
builder . UpdateLockingState ( "12" , lock_state . locked , null /* geolocaion */ , 15.03 , null /* version info */ ) ,
2022-09-06 16:08:19 +02:00
Is . EqualTo ( "request=booking_update&bike=12&lock_state=locked&voltage=15.03&authcookie=MySessionCookieMyMeranctIt" ) ) ;
}
[Test]
2023-07-04 11:06:38 +02:00
public void TestUpdateLockingStateGeolocationIsNullBatteryPercentageIsNAN ( )
2022-09-06 16:08:19 +02:00
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
2023-07-04 11:06:38 +02:00
builder . UpdateLockingState ( "12" , lock_state . locked , null /* geolocaion */ , double . NaN , null /* version info */ ) ,
2022-09-06 16:08:19 +02:00
Is . EqualTo ( "request=booking_update&bike=12&lock_state=locked&authcookie=MySessionCookieMyMeranctIt" ) ) ;
}
[Test]
2023-07-04 11:06:38 +02:00
public void TestUpdateLockingStateGeolocation_AccuraycyNull ( )
2022-09-06 16:08:19 +02:00
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
2023-07-04 11:06:38 +02:00
builder . UpdateLockingState ( "12" , lock_state . locked , new LocationDto . Builder { Latitude = 21 , Longitude = 17 , Age = new TimeSpan ( 0 , 0 , 0 , 0 , 70 ) } . Build ( ) , 12 , null /* version info */ ) ,
2022-09-06 16:08:19 +02:00
Is . EqualTo ( "request=booking_update&bike=12&gps=21,17&gps_age=0.07&lock_state=locked&voltage=12&authcookie=MySessionCookieMyMeranctIt" ) ) ;
}
[Test]
2023-07-04 11:06:38 +02:00
public void TestUpdateLockingStateGeolocation_AccuraycyNullBatteryPercentageIsNAN ( )
2022-09-06 16:08:19 +02:00
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
2023-07-04 11:06:38 +02:00
builder . UpdateLockingState ( "12" , lock_state . locked , new LocationDto . Builder { Latitude = 21 , Longitude = 17 , Age = new TimeSpan ( 0 , 0 , 0 , 0 , 70 ) } . Build ( ) , double . NaN , null /* version info */ ) ,
2022-09-06 16:08:19 +02:00
Is . EqualTo ( "request=booking_update&bike=12&gps=21,17&gps_age=0.07&lock_state=locked&authcookie=MySessionCookieMyMeranctIt" ) ) ;
}
[Test]
2023-07-04 11:06:38 +02:00
public void TestUpdateLockingStateGeolocation ( )
2022-09-06 16:08:19 +02:00
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
2023-07-04 11:06:38 +02:00
builder . UpdateLockingState ( "12" , lock_state . locked , new LocationDto . Builder { Latitude = 21 , Longitude = 17 , Accuracy = 5.7 , Age = new TimeSpan ( 0 , 0 , 0 , 0 , 70 ) } . Build ( ) , 98 , null /* version info */ ) ,
2022-09-06 16:08:19 +02:00
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" ) ) ;
}
2022-09-20 13:51:55 +02:00
[Test]
2023-07-04 11:06:38 +02:00
public void TestUpdateLockingStateVersionsInfo ( )
2022-09-20 13:51:55 +02:00
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
2023-07-04 11:06:38 +02:00
WebUtility . UrlDecode ( builder . UpdateLockingState ( "12" , lock_state . locked , null /* geolocaion */ , 15.03 , new TINK . Model . Bikes . BikeInfoNS . BluetoothLock . VersionInfo . Builder { FirmwareVersion = 13 , HardwareVersion = 12 , LockVersion = 14 } . Build ( ) ) ) ,
2022-09-22 20:58:30 +02:00
Is . EqualTo ( "request=booking_update&bike=12&lock_state=locked&voltage=15.03&firmware=HW 12;FW 13;Lock 14&authcookie=MySessionCookieMyMeranctIt" ) ) ;
2022-09-20 13:51:55 +02:00
}
2022-09-06 16:08:19 +02:00
[Test]
2023-01-18 14:22:51 +01:00
public void TestDoReturn ( )
2022-09-06 16:08:19 +02:00
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
2023-02-22 14:03:35 +01:00
builder . DoReturn ( "12" , null /* Geolocation */ ) ,
2022-09-06 16:08:19 +02:00
Is . EqualTo ( "request=booking_update&bike=12&authcookie=MySessionCookieMyMeranctIt&state=available&lock_state=locked" ) ) ;
}
[Test]
public void TestDoReturnGeolocation_AccuraycyNull ( )
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
builder . DoReturn (
"12" ,
2023-02-22 14:03:35 +01:00
new LocationDto . Builder { Latitude = 21 , Longitude = 17 , Age = new TimeSpan ( 0 , 0 , 0 , 0 , 70 ) } . Build ( ) ) ,
2022-09-06 16:08:19 +02:00
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" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
builder . DoReturn (
"12" ,
2023-02-22 14:03:35 +01:00
new LocationDto . Builder { Latitude = 21 , Longitude = 17 , Accuracy = 5.7 , Age = new TimeSpan ( 0 , 0 , 0 , 0 , 70 ) } . Build ( ) ) ,
2022-09-06 16:08:19 +02:00
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" ) ) ;
}
2023-01-18 14:22:51 +01:00
[Test]
public void TestDoReturnSmartDeviceManufacturer ( )
{
var sd = Substitute . For < ISmartDevice > ( ) ;
sd . Manufacturer . Returns ( "Färphone" ) ;
2023-02-22 14:03:35 +01:00
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" , sd ) ;
2023-01-18 14:22:51 +01:00
Assert . That (
builder . DoReturn (
"12" ,
2023-02-22 14:03:35 +01:00
null ) , // Geolocation
Is . EqualTo ( "request=booking_update&bike=12&authcookie=MySessionCookieMyMeranctIt&state=available&lock_state=locked&user_device_manufacturer=F%C3%A4rphone" ) ) ;
2023-01-18 14:22:51 +01:00
}
[Test]
public void TestDoReturnSmartDeviceModel ( )
{
var sd = Substitute . For < ISmartDevice > ( ) ;
sd . Model . Returns ( "Fön" ) ;
2023-02-22 14:03:35 +01:00
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" , sd ) ;
2023-01-18 14:22:51 +01:00
Assert . That (
builder . DoReturn (
"12" ,
2023-02-22 14:03:35 +01:00
null ) , // Geolocation
2023-01-18 14:22:51 +01:00
Is . EqualTo ( "request=booking_update&bike=12&authcookie=MySessionCookieMyMeranctIt&state=available&lock_state=locked&user_device_model=F%C3%B6n" ) ) ;
}
[Test]
public void TestDoReturnSmartDeviceVersion ( )
{
var sd = Substitute . For < ISmartDevice > ( ) ;
sd . VersionText . Returns ( "ß1" ) ;
2023-02-22 14:03:35 +01:00
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" , sd ) ;
2023-01-18 14:22:51 +01:00
Assert . That (
builder . DoReturn (
"12" ,
2023-02-22 14:03:35 +01:00
null ) , // Geolocation
2023-01-18 14:22:51 +01:00
Is . EqualTo ( "request=booking_update&bike=12&authcookie=MySessionCookieMyMeranctIt&state=available&lock_state=locked&user_device_version=%C3%9F1" ) ) ;
}
[Test]
public void TestDoReturnSmartDeviceIdentifier ( )
{
var sd = Substitute . For < ISmartDevice > ( ) ;
sd . Identifier . Returns ( "ß9" ) ;
2023-02-22 14:03:35 +01:00
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" , sd ) ;
2023-01-18 14:22:51 +01:00
Assert . That (
builder . DoReturn (
"12" ,
2023-02-22 14:03:35 +01:00
null ) , // Geolocation
2023-01-18 14:22:51 +01:00
Is . EqualTo ( "request=booking_update&bike=12&authcookie=MySessionCookieMyMeranctIt&state=available&lock_state=locked&user_device_id=%C3%9F9" ) ) ;
}
2022-09-06 16:08:19 +02:00
[Test]
public void TestDoSubmitFeedback_Ok ( )
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "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" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
builder . DoSubmitFeedback ( "Cycle33" , null , isBikeBroken : true ) ,
Is . EqualTo ( "request=user_feedback&bike=Cycle33&bike_broken=1&authcookie=MySessionCookieMyMeranctIt" ) ) ;
}
[Test]
public void TestDoSubmitFeedback_Message ( )
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
builder . DoSubmitFeedback ( "Mühle" , null , "Uno due tre" ) ,
2023-01-18 14:22:51 +01:00
Is . EqualTo ( "request=user_feedback&bike=M%C3%BChle&message=Uno+due+tre&authcookie=MySessionCookieMyMeranctIt" ) ) ;
2022-09-06 16:08:19 +02:00
}
[Test]
public void TestDoSubmitFeedback_ErrorMessage ( )
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
builder . DoSubmitFeedback ( "bike12" , null , "Uno due tre" , true ) ,
Is . EqualTo ( "request=user_feedback&bike=bike12&bike_broken=1&message=Uno+due+tre&authcookie=MySessionCookieMyMeranctIt" ) ) ;
}
[Test]
public void TestDoSubmitFeedback_ChargeLevel ( )
{
var builder = new RequestBuilderLoggedIn ( "MyMeranctIt" , null /*UI language */ , "MySessionCookie" ) ;
Assert . That (
builder . DoSubmitFeedback ( "bike12" , 3 , "Uno due tre" , true ) ,
Is . EqualTo ( "request=user_feedback&bike=bike12&charge_current_bars=3&bike_broken=1&message=Uno+due+tre&authcookie=MySessionCookieMyMeranctIt" ) ) ;
}
}
2021-07-12 21:31:46 +02:00
}