mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-02-22 10:56:27 +01:00
Version 3.0.270
This commit is contained in:
parent
67999ef4ae
commit
e0c75d5b37
81 changed files with 812 additions and 474 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.267" android:versionCode="267">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.LastenradBayern" android:versionName="3.0.270" android:versionCode="270">
|
||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
|
||||
<!-- Google Maps related permissions -->
|
||||
<!-- Permission to receive remote notifications from Google Play Services -->
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
<key>CFBundleDisplayName</key>
|
||||
<string>LastenradBayern</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>267</string>
|
||||
<string>270</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.267</string>
|
||||
<string>3.0.270</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -141,12 +141,15 @@ namespace TINK
|
|||
|
||||
var appInfoService = DependencyService.Get<IAppInfo>();
|
||||
|
||||
const string MERCHANTID = "baei987w";
|
||||
|
||||
// Create new app instnace.
|
||||
Log.Debug("Constructing main model...");
|
||||
m_oModelRoot = new TinkApp(
|
||||
settings,
|
||||
store, // Manages user account
|
||||
(isConnected, activeUri, sessionCookie, mail, expiresAfter) => ConnectorFactory.Create(isConnected, activeUri, new Repository.AppContextInfo("baei987w", "LastenradBayern", appInfoService.Version), sessionCookie, mail, expiresAfter),
|
||||
(isConnected, activeUri, sessionCookie, mail, expiresAfter) => ConnectorFactory.Create(isConnected, activeUri, new Repository.AppContextInfo(MERCHANTID, "LastenradBayern", appInfoService.Version), sessionCookie, mail, expiresAfter),
|
||||
MERCHANTID,
|
||||
GeolocationServicesContainer,
|
||||
null, /* locksService */
|
||||
DependencyService.Get<ISmartDevice>(),
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace TINK.View.CopriWebView
|
|||
};
|
||||
|
||||
RegisterView.BindingContext = new RegisterPageViewModel(
|
||||
Model.TinkApp.MerchantId,
|
||||
App.ModelRoot.NextActiveUri.Host);
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace TINK.View.FindBike
|
|||
(isConnected) => model.GetConnector(isConnected),
|
||||
App.GeolocationServicesContainer.Active,
|
||||
model.LocksServices.Active,
|
||||
model.Stations,
|
||||
model.Polling,
|
||||
(d, obj) => synchronizationContext.Post(d, obj),
|
||||
model.SmartDevice,
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace TINK.View.MyBikes
|
|||
(isConnected) => model.GetConnector(isConnected),
|
||||
App.GeolocationServicesContainer.Active,
|
||||
model.LocksServices.Active,
|
||||
model.Stations,
|
||||
model.Polling,
|
||||
(d, obj) => synchronizationContext.Post(d, obj),
|
||||
model.SmartDevice,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.267" android:versionCode="267">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.TeilRad.Meinkonrad" android:versionName="3.0.270" android:versionCode="270">
|
||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
|
||||
<!-- Google Maps related permissions -->
|
||||
<!-- Permission to receive remote notifications from Google Play Services -->
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
<key>CFBundleDisplayName</key>
|
||||
<string>Mein konrad</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>267</string>
|
||||
<string>270</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.267</string>
|
||||
<string>3.0.270</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -140,12 +140,15 @@ namespace TINK
|
|||
|
||||
var appInfoService = DependencyService.Get<IAppInfo>();
|
||||
|
||||
const string MERCHANTID = "mkef9BuN";
|
||||
|
||||
// Create new app instnace.
|
||||
Log.Debug("Constructing main model...");
|
||||
m_oModelRoot = new TinkApp(
|
||||
settings,
|
||||
store, // Manages user account
|
||||
(isConnected, activeUri, sessionCookie, mail, expiresAfter) => ConnectorFactory.Create(isConnected, activeUri, new Repository.AppContextInfo("mkef9BuN", "Meinkonrad", appInfoService.Version), sessionCookie, mail, expiresAfter),
|
||||
(isConnected, activeUri, sessionCookie, mail, expiresAfter) => ConnectorFactory.Create(isConnected, activeUri, new Repository.AppContextInfo(MERCHANTID, "Meinkonrad", appInfoService.Version), sessionCookie, mail, expiresAfter),
|
||||
MERCHANTID,
|
||||
GeolocationServicesContainer,
|
||||
null, /* locksService */
|
||||
DependencyService.Get<ISmartDevice>(),
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace TINK.View.CopriWebView
|
|||
};
|
||||
|
||||
RegisterView.BindingContext = new RegisterPageViewModel(
|
||||
Model.TinkApp.MerchantId,
|
||||
App.ModelRoot.NextActiveUri.Host);
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace TINK.View.FindBike
|
|||
(isConnected) => model.GetConnector(isConnected),
|
||||
App.GeolocationServicesContainer.Active,
|
||||
model.LocksServices.Active,
|
||||
model.Stations,
|
||||
model.Polling,
|
||||
(d, obj) => synchronizationContext.Post(d, obj),
|
||||
model.SmartDevice,
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace TINK.View.MyBikes
|
|||
(isConnected) => model.GetConnector(isConnected),
|
||||
App.GeolocationServicesContainer.Active,
|
||||
model.LocksServices.Active,
|
||||
model.Stations,
|
||||
model.Polling,
|
||||
(d, obj) => synchronizationContext.Post(d, obj),
|
||||
model.SmartDevice,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="com.hauffware.sharee" android:versionName="3.0.267" android:versionCode="267">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="com.hauffware.sharee" android:versionName="3.0.270" android:versionCode="270">
|
||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
|
||||
<!-- Google Maps related permissions -->
|
||||
<!-- Permission to receive remote notifications from Google Play Services -->
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
<key>CFBundleDisplayName</key>
|
||||
<string>sharee.bike</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>267</string>
|
||||
<string>270</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.267</string>
|
||||
<string>3.0.270</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -140,12 +140,15 @@ namespace TINK
|
|||
|
||||
var appInfoService = DependencyService.Get<IAppInfo>();
|
||||
|
||||
const string MERCHANTID = "oiF2kahH";
|
||||
|
||||
// Create new app instnace.
|
||||
Log.Debug("Constructing main model...");
|
||||
m_oModelRoot = new TinkApp(
|
||||
settings,
|
||||
store, // Manages user account
|
||||
(isConnected, activeUri, sessionCookie, mail, expiresAfter) => ConnectorFactory.Create(isConnected, activeUri, new Repository.AppContextInfo("oiF2kahH", "sharee.bike", appInfoService.Version), sessionCookie, mail, expiresAfter),
|
||||
(isConnected, activeUri, sessionCookie, mail, expiresAfter) => ConnectorFactory.Create(isConnected, activeUri, new Repository.AppContextInfo(MERCHANTID, "sharee.bike", appInfoService.Version), sessionCookie, mail, expiresAfter),
|
||||
MERCHANTID,
|
||||
GeolocationServicesContainer,
|
||||
null, /* locksService */
|
||||
DependencyService.Get<ISmartDevice>(),
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace TINK.View.CopriWebView
|
|||
};
|
||||
|
||||
RegisterView.BindingContext = new RegisterPageViewModel(
|
||||
Model.TinkApp.MerchantId,
|
||||
App.ModelRoot.NextActiveUri.Host);
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace TINK.View.FindBike
|
|||
(isConnected) => model.GetConnector(isConnected),
|
||||
App.GeolocationServicesContainer.Active,
|
||||
model.LocksServices.Active,
|
||||
model.Stations,
|
||||
model.Polling,
|
||||
(d, obj) => synchronizationContext.Post(d, obj),
|
||||
model.SmartDevice,
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace TINK.View.MyBikes
|
|||
(isConnected) => model.GetConnector(isConnected),
|
||||
App.GeolocationServicesContainer.Active,
|
||||
model.LocksServices.Active,
|
||||
model.Stations,
|
||||
model.Polling,
|
||||
(d, obj) => synchronizationContext.Post(d, obj),
|
||||
model.SmartDevice,
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace TINK.Model.Bike.BC
|
|||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string currentStationId = null,
|
||||
string stationId = null,
|
||||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ namespace TINK.Model.Bike.BC
|
|||
|
||||
IsDemo = isDemo ?? DEFAULTVALUEISDEMO;
|
||||
Group = group ?? new List<string>();
|
||||
CurrentStation = currentStationId;
|
||||
StationId = stationId;
|
||||
OperatorUri = operatorUri;
|
||||
TariffDescription = tariffDescription;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace TINK.Model.Bike.BC
|
|||
bikeInfo.WheelType,
|
||||
bikeInfo.TypeOfBike,
|
||||
bikeInfo.Description,
|
||||
bikeInfo.CurrentStation,
|
||||
bikeInfo.StationId,
|
||||
bikeInfo.OperatorUri,
|
||||
bikeInfo.TariffDescription) { }
|
||||
|
||||
|
@ -58,13 +58,13 @@ namespace TINK.Model.Bike.BC
|
|||
/// Constructs a bike info object for a available bike.
|
||||
/// </summary>
|
||||
/// <param name="id">Unique id of bike.</param>
|
||||
/// <param name="currentStationId">Id of station where bike is located.</param>
|
||||
/// <param name="stationId">Id of station where bike is located.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="wheelType"></param>
|
||||
public BikeInfo(
|
||||
string id,
|
||||
string currentStationId,
|
||||
string stationId,
|
||||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null,
|
||||
bool? isDemo = DEFAULTVALUEISDEMO,
|
||||
|
@ -79,7 +79,7 @@ namespace TINK.Model.Bike.BC
|
|||
wheelType,
|
||||
typeOfBike,
|
||||
description,
|
||||
currentStationId,
|
||||
stationId,
|
||||
operatorUri,
|
||||
tariffDescription)
|
||||
{
|
||||
|
@ -179,7 +179,7 @@ namespace TINK.Model.Bike.BC
|
|||
/// <summary>
|
||||
/// Station a which bike is located, null otherwise.
|
||||
/// </summary>
|
||||
public string CurrentStation { get; }
|
||||
public string StationId { get; }
|
||||
|
||||
/// <summary> Holds description about the tarif. </summary>
|
||||
public TariffDescription TariffDescription { get; }
|
||||
|
@ -210,7 +210,7 @@ namespace TINK.Model.Bike.BC
|
|||
/// </summary>
|
||||
public new string ToString()
|
||||
{
|
||||
return $"Id={Bike.Id}{(Bike.WheelType != null ? $", wheel(s)={Bike.WheelType}" : string.Empty)}{(Bike.TypeOfBike != null ? $"type={Bike.TypeOfBike}" : "")}, state={State}, location={(!string.IsNullOrEmpty(CurrentStation)? $"Station {CurrentStation}" : "On the road")}, is demo={IsDemo}.";
|
||||
return $"Id={Bike.Id}{(Bike.WheelType != null ? $", wheel(s)={Bike.WheelType}" : string.Empty)}{(Bike.TypeOfBike != null ? $"type={Bike.TypeOfBike}" : "")}, state={State}, location={(!string.IsNullOrEmpty(StationId)? $"Station {StationId}" : "On the road")}, is demo={IsDemo}.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace TINK.Model.Bike.BC
|
|||
/// <param name="isDemo">True if device is demo device, false otherwise.</param>
|
||||
/// <param name="dateTimeProvider">Provider for current date time to calculate remainig time on demand for state of type reserved.</param>
|
||||
/// <param name="wheelType"></param>
|
||||
/// <param name="currentStationId">Name of station where bike is located, null if bike is on the road.</param>
|
||||
/// <param name="stationId">Name of station where bike is located, null if bike is on the road.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <param name="tariffDescription">Hold tariff description of bike.</param>
|
||||
/// <param name="stateInfo">Bike state info.</param>
|
||||
|
@ -35,7 +35,8 @@ namespace TINK.Model.Bike.BC
|
|||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string currentStationId = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
|
@ -46,32 +47,36 @@ namespace TINK.Model.Bike.BC
|
|||
m_oBike = new Bike(id, wheelType, typeOfBike, description);
|
||||
m_oStateInfo = new StateInfoMutable(dateTimeProvider, stateInfo);
|
||||
m_oStateInfo.PropertyChanged += (sender, eventargs) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(eventargs.PropertyName));
|
||||
CurrentStation = currentStationId;
|
||||
StationId = stationId;
|
||||
StationName = stationName;
|
||||
OperatorUri = operatorUri;
|
||||
TariffDescription = tariffDescription;
|
||||
}
|
||||
|
||||
/// <summary> Constructs a bike object from source. </summary>
|
||||
public BikeInfoMutable(IBikeInfo p_oBike) : this(
|
||||
p_oBike.Id,
|
||||
p_oBike.IsDemo,
|
||||
p_oBike.Group,
|
||||
p_oBike.WheelType,
|
||||
p_oBike.TypeOfBike,
|
||||
p_oBike.Description,
|
||||
p_oBike.CurrentStation,
|
||||
p_oBike.OperatorUri,
|
||||
p_oBike.TariffDescription,
|
||||
public BikeInfoMutable(IBikeInfo bike, string stationName) : this(
|
||||
bike.Id,
|
||||
bike.IsDemo,
|
||||
bike.Group,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.Description,
|
||||
bike.StationId,
|
||||
stationName,
|
||||
bike.OperatorUri,
|
||||
bike.TariffDescription,
|
||||
null,
|
||||
p_oBike.State)
|
||||
bike.State)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Station a which bike is located, null otherwise.
|
||||
/// </summary>
|
||||
/// <summary> Id of station a which bike is located, null otherwise.</summary>
|
||||
[DataMember]
|
||||
public string CurrentStation { get; }
|
||||
public string StationId { get; }
|
||||
|
||||
/// <summary> Name of station a which bike is located, null otherwise. </summary>
|
||||
[DataMember]
|
||||
public string StationName { get; }
|
||||
|
||||
/// <summary> Holds description about the tarif. </summary>
|
||||
[DataMember]
|
||||
|
@ -118,7 +123,7 @@ namespace TINK.Model.Bike.BC
|
|||
/// <returns></returns>
|
||||
public new string ToString()
|
||||
{
|
||||
return $"Id={Id}{(WheelType != null ? $", wheel(s)={WheelType}" : string.Empty)}{(TypeOfBike != null ? $", type={TypeOfBike}" : "")}, demo={IsDemo}, state={State.ToString()}, location={(!string.IsNullOrEmpty(CurrentStation) ? $"Station {CurrentStation}" : "On the road")}.";
|
||||
return $"Id={Id}{(WheelType != null ? $", wheel(s)={WheelType}" : string.Empty)}{(TypeOfBike != null ? $", type={TypeOfBike}" : "")}, demo={IsDemo}, state={State.ToString()}, location={(!string.IsNullOrEmpty(StationId) ? $"Station {StationId}" : "On the road")}.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace TINK.Model.Bike.BC
|
|||
/// <summary>
|
||||
/// Station a which bike is located, null otherwise.
|
||||
/// </summary>
|
||||
string CurrentStation { get; }
|
||||
string StationId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Uri of the operator or null, in case of single operator setup.
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace TINK.Model.Bikes.Bike.BC
|
|||
/// <summary>
|
||||
/// Station a which bike is located, null otherwise.
|
||||
/// </summary>
|
||||
string CurrentStation { get; }
|
||||
string StationId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the rent state of the bike.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using TINK.Model.Bikes.Bike;
|
||||
using TINK.Model.Bikes.Bike.BluetoothLock;
|
||||
|
||||
namespace TINK.Model.Bike.BluetoothLock
|
||||
|
@ -7,14 +6,15 @@ namespace TINK.Model.Bike.BluetoothLock
|
|||
public class BikeInfoMutable : BC.BikeInfoMutable, IBikeInfoMutable
|
||||
{
|
||||
/// <summary> Constructs a bike object from source. </summary>
|
||||
public BikeInfoMutable(BikeInfo bike) : base(
|
||||
public BikeInfoMutable(BikeInfo bike, string stationName) : base(
|
||||
bike.Id,
|
||||
bike.IsDemo,
|
||||
bike.Group,
|
||||
bike.WheelType,
|
||||
bike.TypeOfBike,
|
||||
bike.Description,
|
||||
bike.CurrentStation,
|
||||
bike.StationId,
|
||||
stationName,
|
||||
bike.OperatorUri,
|
||||
bike.TariffDescription,
|
||||
() => DateTime.Now,
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace TINK.Model
|
|||
string selectedStation)
|
||||
{
|
||||
return new BikeCollection(bikesAtAnyStation?
|
||||
.Where(bike => !string.IsNullOrEmpty(selectedStation) && bike.CurrentStation == selectedStation)
|
||||
.Where(bike => !string.IsNullOrEmpty(selectedStation) && bike.StationId == selectedStation)
|
||||
.ToDictionary(x => x.Id) ?? new Dictionary<string, BikeInfo>());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
using TINK.Model.Station;
|
||||
using BikeInfo = TINK.Model.Bike.BC.BikeInfo;
|
||||
using BikeInfoMutable = TINK.Model.Bike.BC.BikeInfoMutable;
|
||||
|
||||
|
@ -22,10 +23,11 @@ namespace TINK.Model.Bike
|
|||
/// - removes bikes which are no more contained in bikes response
|
||||
/// - updates state of all bikes from state contained in bikes response
|
||||
/// </summary>
|
||||
/// <param name="bikesAll"> Object holding bikes info from copri to update from.</param>
|
||||
/// <param name="bikesAll"> Object holding bikes info from copri to update from. Holds station id but not station name.</param>
|
||||
/// <param name="stations"> All stations to get station names from.</param>
|
||||
/// <param name="p_oDateTimeProvider">Provices date time information.</param>
|
||||
public void Update(
|
||||
IEnumerable<BikeInfo> bikesAll)
|
||||
public void Update(IEnumerable<BikeInfo> bikesAll,
|
||||
IEnumerable<IStation> stations)
|
||||
{
|
||||
// Get list of current bikes by state(s) to update.
|
||||
// Needed to remove bikes which switched state and have to be removed from collection.
|
||||
|
@ -33,11 +35,16 @@ namespace TINK.Model.Bike
|
|||
|
||||
foreach (var bikeInfo in bikesAll ?? new List<BikeInfo>())
|
||||
{
|
||||
/// Check if bike has to be added to list of existing station.
|
||||
// Get name of station form station id.
|
||||
var stationName = stations?.FirstOrDefault(x => x.Id == bikeInfo.StationId)?.StationName ?? string.Empty;
|
||||
if (string.IsNullOrEmpty(stationName))
|
||||
Log.ForContext<BikeCollectionMutable>().Debug($"No name for station with id {bikeInfo.StationId} found.");
|
||||
|
||||
// Check if bike has to be added to list of existing station.
|
||||
if (ContainsKey(bikeInfo.Id) == false)
|
||||
{
|
||||
// Bike does not yet exist in list of bikes.
|
||||
Add(BikeInfoMutableFactory.Create(bikeInfo));
|
||||
Add(BikeInfoMutableFactory.Create(bikeInfo, stationName));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -52,29 +59,29 @@ namespace TINK.Model.Bike
|
|||
}
|
||||
|
||||
// Remove obsolete bikes.
|
||||
foreach (var l_oId in bikesToBeRemoved)
|
||||
foreach (var stationId in bikesToBeRemoved)
|
||||
{
|
||||
RemoveById(l_oId);
|
||||
RemoveById(stationId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new bike to collecion of bike.
|
||||
/// </summary>
|
||||
/// <param name="p_oNewBike">New bike to add.</param>
|
||||
/// <param name="newBike">New bike to add.</param>
|
||||
/// <exception cref="Exception">Thrown if bike is not unique.</exception>
|
||||
public new void Add(BikeInfoMutable p_oNewBike)
|
||||
public new void Add(BikeInfoMutable newBike)
|
||||
{
|
||||
// Ensure that bike id of new bike is is unique
|
||||
foreach (BikeInfoMutable l_oBike in Items)
|
||||
foreach (BikeInfoMutable bike in Items)
|
||||
{
|
||||
if (l_oBike.Id == p_oNewBike.Id)
|
||||
if (bike.Id == newBike.Id)
|
||||
{
|
||||
throw new Exception(string.Format("Can not add bike with {0} to collection ob bike. Id is not unnique.", p_oNewBike));
|
||||
throw new Exception(string.Format("Can not add bike with {0} to collection ob bike. Id is not unnique.", newBike));
|
||||
}
|
||||
}
|
||||
|
||||
base.Add(p_oNewBike);
|
||||
base.Add(newBike);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -134,11 +141,11 @@ namespace TINK.Model.Bike
|
|||
/// </summary>
|
||||
private static class BikeInfoMutableFactory
|
||||
{
|
||||
public static BikeInfoMutable Create(BikeInfo bikeInfo)
|
||||
public static BikeInfoMutable Create(BikeInfo bikeInfo, string stationName)
|
||||
{
|
||||
return (bikeInfo is BluetoothLock.BikeInfo bluetoothLockBikeInfo)
|
||||
? new BluetoothLock.BikeInfoMutable(bluetoothLockBikeInfo)
|
||||
: new BikeInfoMutable(bikeInfo);
|
||||
? new BluetoothLock.BikeInfoMutable(bluetoothLockBikeInfo, stationName)
|
||||
: new BikeInfoMutable(bikeInfo, stationName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace TINK.Model.Connector
|
|||
{
|
||||
response = (await CopriServer.DoAuthorizationAsync(mail, password, deviceId)).GetIsResponseOk(mail);
|
||||
}
|
||||
catch (System.Exception)
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace TINK.Model.Connector
|
|||
/// <summary>Constructs a copri query object.</summary>
|
||||
/// <param name="p_oCopriServer">Server which implements communication.</param>
|
||||
public CommandLoggedIn(ICopriServerBase p_oCopriServer,
|
||||
string p_strSessionCookie,
|
||||
string p_strMail,
|
||||
Func<DateTime> p_oDateTimeProvider) : base(p_oCopriServer, p_strSessionCookie, p_strMail, p_oDateTimeProvider)
|
||||
string sessionCookie,
|
||||
string mail,
|
||||
Func<DateTime> dateTimeProvider) : base(p_oCopriServer, sessionCookie, mail, dateTimeProvider)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,14 +36,14 @@ namespace TINK.Model.Connector
|
|||
/// If communication fails an TINK.Repository.Exception is thrown.
|
||||
/// </summary>
|
||||
/// <param name="p_oAccount">Account to use for login.</param>
|
||||
public Task<IAccount> DoLogin(string p_strMail, string p_strPassword, string p_strDeviceId)
|
||||
public Task<IAccount> DoLogin(string mail, string password, string deviceId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(p_strMail))
|
||||
if (string.IsNullOrEmpty(mail))
|
||||
{
|
||||
throw new ArgumentNullException("Can not loging user. Mail address must not be null or empty.");
|
||||
}
|
||||
|
||||
throw new Exception($"Fehler beim Anmelden von unter {p_strMail}. Benutzer {Mail} ist bereits angemeldet.");
|
||||
throw new Exception($"Fehler beim Anmelden von unter {mail}. Benutzer {Mail} ist bereits angemeldet.");
|
||||
}
|
||||
|
||||
/// <summary> Logs user out. </summary>
|
||||
|
|
|
@ -25,12 +25,12 @@ namespace TINK.Model.Connector
|
|||
ICachedCopriServer server = null )
|
||||
{
|
||||
Command = GetCommand(
|
||||
server ?? new CopriProviderHttps(activeUri, TinkApp.MerchantId, appContextInfo, sessionCookie),
|
||||
server ?? new CopriProviderHttps(activeUri, appContextInfo.MerchantId, appContextInfo, sessionCookie),
|
||||
sessionCookie,
|
||||
mail);
|
||||
|
||||
Query = GetQuery(
|
||||
server ?? new CopriProviderHttps(activeUri, TinkApp.MerchantId, appContextInfo, sessionCookie, expiresAfter),
|
||||
server ?? new CopriProviderHttps(activeUri, appContextInfo.MerchantId, appContextInfo, sessionCookie, expiresAfter),
|
||||
sessionCookie,
|
||||
mail);
|
||||
}
|
||||
|
|
|
@ -14,18 +14,19 @@ namespace TINK.Model.Connector
|
|||
/// <param name="p_strMail">Mail of user.</param>
|
||||
/// <param name="server"> Provides addess to copri.</param>
|
||||
public ConnectorCache(
|
||||
AppContextInfo appContextInfo,
|
||||
string sessionCookie,
|
||||
string mail,
|
||||
ICopriServer server = null)
|
||||
{
|
||||
|
||||
Command = Connector.GetCommand(
|
||||
server ?? new CopriProviderMonkeyStore(TinkApp.MerchantId, sessionCookie),
|
||||
server ?? new CopriProviderMonkeyStore(appContextInfo.MerchantId, sessionCookie),
|
||||
sessionCookie,
|
||||
mail);
|
||||
|
||||
Query = GetQuery(
|
||||
server ?? new CopriProviderMonkeyStore(TinkApp.MerchantId, sessionCookie),
|
||||
server ?? new CopriProviderMonkeyStore(appContextInfo.MerchantId, sessionCookie),
|
||||
sessionCookie,
|
||||
mail);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace TINK.Model.Connector
|
|||
{
|
||||
return isConnected
|
||||
? new Connector(activeUri, appContextInfo, sessionCookie, mail, expiresAfter: expiresAfter) as IConnector
|
||||
: new ConnectorCache(sessionCookie, mail);
|
||||
: new ConnectorCache(appContextInfo, sessionCookie, mail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,24 +16,24 @@ namespace TINK.Model.Connector
|
|||
protected readonly Func<DateTime> DateTimeProvider;
|
||||
|
||||
/// <summary>Constructs a copri query object.</summary>
|
||||
/// <param name="p_oCopriServer">Server which implements communication.</param>
|
||||
public BaseLoggedIn(ICopriServerBase p_oCopriServer,
|
||||
string p_strSessionCookie,
|
||||
string p_strMail,
|
||||
Func<DateTime> p_oDateTimeProvider) : base(p_oCopriServer)
|
||||
/// <param name="copriServer">Server which implements communication.</param>
|
||||
public BaseLoggedIn(ICopriServerBase copriServer,
|
||||
string sessionCookie,
|
||||
string mail,
|
||||
Func<DateTime> p_oDateTimeProvider) : base(copriServer)
|
||||
{
|
||||
if (string.IsNullOrEmpty(p_strSessionCookie))
|
||||
if (string.IsNullOrEmpty(sessionCookie))
|
||||
throw new ArgumentException("Can not instantiate query object- object. Session cookie must never be null or emtpy.");
|
||||
|
||||
if (string.IsNullOrEmpty(p_strMail))
|
||||
if (string.IsNullOrEmpty(mail))
|
||||
throw new ArgumentException("Can not instantiate query object- object. Mail address must never be null or emtpy.");
|
||||
|
||||
DateTimeProvider = p_oDateTimeProvider
|
||||
?? throw new ArgumentException("Can not instantiate connector- object. No date time provider object available.");
|
||||
|
||||
SessionCookie = p_strSessionCookie;
|
||||
SessionCookie = sessionCookie;
|
||||
|
||||
Mail = p_strMail;
|
||||
Mail = mail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,30 +26,30 @@ namespace TINK.Model.Connector
|
|||
/// <summary>
|
||||
/// Gets the position from StationInfo object.
|
||||
/// </summary>
|
||||
/// <param name="p_oStationInfo">Object to get information from.</param>
|
||||
/// <param name="stationInfo">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static Station.Position GetPosition(this StationsAvailableResponse.StationInfo p_oStationInfo)
|
||||
public static Station.Position GetPosition(this StationsAvailableResponse.StationInfo stationInfo)
|
||||
{
|
||||
return GetPosition(p_oStationInfo.gps);
|
||||
return GetPosition(stationInfo.gps);
|
||||
}
|
||||
|
||||
/// <summary> Gets the position from StationInfo object. </summary>
|
||||
/// <param name="p_oAuthorizationResponse">Object to get information from.</param>
|
||||
/// <param name="authorizationResponse">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static IEnumerable<string> GetGroup(this AuthorizationResponse p_oAuthorizationResponse)
|
||||
public static IEnumerable<string> GetGroup(this AuthorizationResponse authorizationResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
return p_oAuthorizationResponse.user_group.GetGroup();
|
||||
return authorizationResponse.user_group.GetGroup();
|
||||
}
|
||||
catch (Exception l_oException)
|
||||
{
|
||||
throw new Exception($"Can not get group of user from text \"{p_oAuthorizationResponse.user_group}\".", l_oException);
|
||||
throw new Exception($"Can not get group of user from text \"{authorizationResponse.user_group}\".", l_oException);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets the position from StationInfo object. </summary>
|
||||
/// <param name="p_oAuthorizationResponse">Object to get information from.</param>
|
||||
/// <param name="group">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static IEnumerable<string> GetGroup(this string[] group)
|
||||
{
|
||||
|
@ -63,43 +63,50 @@ namespace TINK.Model.Connector
|
|||
return new HashSet<string>(group).ToList();
|
||||
}
|
||||
|
||||
/// <summary> Gets the position from StationInfo object. </summary>
|
||||
/// <param name="p_oAuthorizationResponse">Object to get information from.</param>
|
||||
/// <summary> Gets if user acknowldged ags or not. </summary>
|
||||
/// <param name="authorizationResponse">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static string GetGroup(this IEnumerable<string> p_oGroup)
|
||||
public static bool GetIsAgbAcknowledged(this AuthorizationResponse authorizationResponse)
|
||||
=> int.TryParse(authorizationResponse?.agb_checked, out int result)
|
||||
&& result != 0;
|
||||
|
||||
/// <summary> Gets the position from StationInfo object. </summary>
|
||||
/// <param name="group">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static string GetGroup(this IEnumerable<string> group)
|
||||
{
|
||||
return string.Join(",", p_oGroup);
|
||||
return string.Join(",", group);
|
||||
}
|
||||
|
||||
/// <summary> Gets the position from StationInfo object. </summary>
|
||||
/// <param name="p_oStationInfo">Object to get information from.</param>
|
||||
/// <param name="stationInfo">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static IEnumerable<string> GetGroup(this StationsAvailableResponse.StationInfo p_oStationInfo)
|
||||
public static IEnumerable<string> GetGroup(this StationsAvailableResponse.StationInfo stationInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
return p_oStationInfo.station_group.GetGroup();
|
||||
return stationInfo.station_group.GetGroup();
|
||||
}
|
||||
catch (Exception l_oException)
|
||||
{
|
||||
throw new Exception($"Can not get group of stations from text \"{p_oStationInfo.station_group}\".", l_oException);
|
||||
throw new Exception($"Can not get group of stations from text \"{stationInfo.station_group}\".", l_oException);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the position from StationInfo object.
|
||||
/// </summary>
|
||||
/// <param name="p_oBikeInfo">Object to get information from.</param>
|
||||
/// <param name="bikeInfo">Object to get information from.</param>
|
||||
/// <returns>Position information.</returns>
|
||||
public static InUseStateEnum GetState(this BikeInfoBase p_oBikeInfo)
|
||||
public static InUseStateEnum GetState(this BikeInfoBase bikeInfo)
|
||||
{
|
||||
var l_oState = p_oBikeInfo.state;
|
||||
var l_oState = bikeInfo.state;
|
||||
|
||||
if (string.IsNullOrEmpty(l_oState))
|
||||
{
|
||||
throw new InvalidResponseException<BikeInfoBase>(
|
||||
string.Format("Unknown reservation state detected. Member {0}.{1}.", typeof(BikeInfoBase), nameof(BikeInfoBase.state)),
|
||||
p_oBikeInfo);
|
||||
bikeInfo);
|
||||
}
|
||||
|
||||
if (l_oState == "available")
|
||||
|
@ -123,58 +130,58 @@ namespace TINK.Model.Connector
|
|||
/// <summary>
|
||||
/// Gets the from date information from JSON.
|
||||
/// </summary>
|
||||
/// <param name="p_oBikeInfo">JSON to get information from..</param>
|
||||
/// <param name="bikeInfo">JSON to get information from..</param>
|
||||
/// <returns>From information.</returns>
|
||||
public static DateTime GetFrom(this BikeInfoReservedOrBooked p_oBikeInfo)
|
||||
public static DateTime GetFrom(this BikeInfoReservedOrBooked bikeInfo)
|
||||
{
|
||||
return DateTime.Parse(p_oBikeInfo.start_time);
|
||||
return DateTime.Parse(bikeInfo.start_time);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the bike is a trike or not.
|
||||
/// </summary>
|
||||
/// <param name="p_oBikeInfo">JSON to get information from..</param>
|
||||
/// <param name="bikeInfo">JSON to get information from..</param>
|
||||
/// <returns>From information.</returns>
|
||||
public static bool? GetIsDemo(this BikeInfoBase p_oBikeInfo)
|
||||
public static bool? GetIsDemo(this BikeInfoBase bikeInfo)
|
||||
{
|
||||
return p_oBikeInfo?.description != null
|
||||
? p_oBikeInfo.description.ToUpper().Contains(DEMOBIKEMARKER)
|
||||
return bikeInfo?.description != null
|
||||
? bikeInfo.description.ToUpper().Contains(DEMOBIKEMARKER)
|
||||
: (bool?) null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the bike is a trike or not.
|
||||
/// </summary>
|
||||
/// <param name="p_oBikeInfo">JSON to get information from..</param>
|
||||
/// <param name="bikeInfo">JSON to get information from.</param>
|
||||
/// <returns>From information.</returns>
|
||||
public static IEnumerable<string> GetGroup(this BikeInfoBase p_oBikeInfo)
|
||||
public static IEnumerable<string> GetGroup(this BikeInfoBase bikeInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
return p_oBikeInfo?.bike_group?.GetGroup()?.ToList() ?? new List<string>();
|
||||
return bikeInfo?.bike_group?.GetGroup()?.ToList() ?? new List<string>();
|
||||
}
|
||||
catch (System.Exception l_oException)
|
||||
{
|
||||
throw new System.Exception($"Can not get group of user from text \"{p_oBikeInfo.bike_group}\".", l_oException);
|
||||
throw new System.Exception($"Can not get group of user from text \"{bikeInfo.bike_group}\".", l_oException);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Gets whether the bike has a bord computer or not. </summary>
|
||||
/// <param name="p_oBikeInfo">JSON to get information from.</param>
|
||||
/// <param name="bikeInfo">JSON to get information from.</param>
|
||||
/// <returns>From information.</returns>
|
||||
public static bool GetIsManualLockBike(this BikeInfoBase p_oBikeInfo)
|
||||
public static bool GetIsManualLockBike(this BikeInfoBase bikeInfo)
|
||||
{
|
||||
return !string.IsNullOrEmpty(p_oBikeInfo.system)
|
||||
&& p_oBikeInfo.system.ToUpper().StartsWith("LOCK");
|
||||
return !string.IsNullOrEmpty(bikeInfo.system)
|
||||
&& bikeInfo.system.ToUpper().StartsWith("LOCK");
|
||||
}
|
||||
|
||||
/// <summary> Gets whether the bike has a bord computer or not. </summary>
|
||||
/// <param name="p_oBikeInfo">JSON to get information from..</param>
|
||||
/// <param name="bikeInfo">JSON to get information from..</param>
|
||||
/// <returns>From information.</returns>
|
||||
public static bool GetIsBluetoothLockBike(this BikeInfoBase p_oBikeInfo)
|
||||
public static bool GetIsBluetoothLockBike(this BikeInfoBase bikeInfo)
|
||||
{
|
||||
return !string.IsNullOrEmpty(p_oBikeInfo.system)
|
||||
&& p_oBikeInfo.system.ToUpper().StartsWith("ILOCKIT");
|
||||
return !string.IsNullOrEmpty(bikeInfo.system)
|
||||
&& bikeInfo.system.ToUpper().StartsWith("ILOCKIT");
|
||||
}
|
||||
|
||||
/// <summary> Gets whether the bike has a bord computer or not. </summary>
|
||||
|
@ -342,13 +349,22 @@ namespace TINK.Model.Connector
|
|||
: null;
|
||||
}
|
||||
|
||||
/// <summary> Tries to get the copriversion from response.</summary>
|
||||
/// <param name="response">Response to get version info from.</param>
|
||||
/// <returns>COPRI version</returns>
|
||||
public static bool TryGetCopriVersion(this CopriVersion response, out Version copriVersion)
|
||||
{
|
||||
copriVersion = new Version(0, 0);
|
||||
return response != null
|
||||
&& !string.IsNullOrEmpty(response.copri_version)
|
||||
&& Version.TryParse(response.copri_version, out copriVersion);
|
||||
}
|
||||
|
||||
/// <summary> Gets the copriversion from.</summary>
|
||||
/// <param name="response">Response to get version info from.</param>
|
||||
/// <returns>COPRI version</returns>
|
||||
public static Version GetCopriVersion(this CopriVersion response)
|
||||
=> response!= null
|
||||
&& !string.IsNullOrEmpty(response.copri_version)
|
||||
&& Version.TryParse(response.copri_version, out Version copriVersion)
|
||||
=> response.TryGetCopriVersion(out Version copriVersion)
|
||||
? copriVersion
|
||||
: throw new InvalidResponseException($"Can not get version info from copri response {response?.copri_version}.");
|
||||
}
|
||||
|
|
|
@ -85,7 +85,9 @@ namespace TINK.Model.Connector
|
|||
/// <param name="response">Response to get data from.</param>
|
||||
/// <returns>General data object initialized form COPRI response.</returns>
|
||||
public static GeneralData GetGeneralData(this ResponseBase response)
|
||||
=> new GeneralData(response.merchant_message, response.GetCopriVersion());
|
||||
=> new GeneralData(response.merchant_message, response.TryGetCopriVersion(out Version copriVersion)
|
||||
? new Version(0,0)
|
||||
: copriVersion);
|
||||
|
||||
/// <summary> Gets account object from login response.</summary>
|
||||
/// <param name="merchantId">Needed to extract cookie from autorization response.</param>
|
||||
|
@ -106,6 +108,7 @@ namespace TINK.Model.Connector
|
|||
return new Account(
|
||||
mail,
|
||||
password,
|
||||
loginResponse.GetIsAgbAcknowledged(),
|
||||
loginResponse.authcookie?.Replace(merchantId, ""),
|
||||
loginResponse.GetGroup(),
|
||||
loginResponse.debuglevel == 1
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace TINK.Model
|
|||
public delegate bool SetCredentialsDelegate(string p_strMailAddress, string p_strPassword);
|
||||
|
||||
/// <summary>Returns the id of the app (sharee.bike) to be identified by copri.</summary>
|
||||
public static string MerchantId => "oiF2kahH";
|
||||
public static string MerchantId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds status about whants new page.
|
||||
|
@ -160,6 +160,7 @@ namespace TINK.Model
|
|||
Settings.Settings settings,
|
||||
IStore accountStore,
|
||||
Func<bool, Uri, string /* session cookie*/, string /* mail address*/, TimeSpan, IConnector> connectorFactory,
|
||||
string merchantId,
|
||||
IServicesContainer<IGeolocation> geolocationServicesContainer,
|
||||
ILocksService locksService,
|
||||
ISmartDevice device,
|
||||
|
@ -179,6 +180,9 @@ namespace TINK.Model
|
|||
ConnectorFactory = connectorFactory
|
||||
?? throw new ArgumentException("Can not instantiate TinkApp- object. No connector factory object available.");
|
||||
|
||||
MerchantId = merchantId
|
||||
?? throw new ArgumentException($"Can not instantiate {nameof(TinkApp)}. No merchant id available.");
|
||||
|
||||
Cipher = cipher ?? new Cipher();
|
||||
|
||||
var locksServices = locksService != null
|
||||
|
|
|
@ -49,6 +49,8 @@ namespace TINK.Model.User.Account
|
|||
/// </summary>
|
||||
public class Account : IAccount
|
||||
{
|
||||
public const bool DEFAULTISAGBACKNOWLEDGED = false;
|
||||
|
||||
/// <summary> Constructs an account object.</summary>
|
||||
/// <param name="mail">Mail address of the account holder.</param>
|
||||
/// <param name="password">Password.</param>
|
||||
|
@ -58,12 +60,14 @@ namespace TINK.Model.User.Account
|
|||
public Account(
|
||||
string mail,
|
||||
string password,
|
||||
bool isAgbAcknowledged,
|
||||
string sessionCookie,
|
||||
IEnumerable<string> bikeGroup,
|
||||
Permissions debugLevel = Permissions.None)
|
||||
{
|
||||
Mail = mail;
|
||||
Pwd = password;
|
||||
IsAgbAcknowledged = isAgbAcknowledged;
|
||||
SessionCookie = sessionCookie;
|
||||
DebugLevel = debugLevel;
|
||||
Group = bikeGroup != null
|
||||
|
@ -71,7 +75,7 @@ namespace TINK.Model.User.Account
|
|||
: throw new ArgumentException("Can not instantiate account object. Reference to group list must not be empty.");
|
||||
}
|
||||
|
||||
public Account(IAccount p_oSource) : this(p_oSource?.Mail, p_oSource?.Pwd, p_oSource?.SessionCookie, p_oSource?.Group, p_oSource?.DebugLevel ?? Permissions.None)
|
||||
public Account(IAccount source) : this(source?.Mail, source?.Pwd, source?.IsAgbAcknowledged ?? DEFAULTISAGBACKNOWLEDGED, source?.SessionCookie, source?.Group, source?.DebugLevel ?? Permissions.None)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -81,6 +85,9 @@ namespace TINK.Model.User.Account
|
|||
/// <summary>Password of to authenticate.</summary>
|
||||
public string Pwd { get; }
|
||||
|
||||
/// <summary>True if user acknowleged agbs.</summary>
|
||||
public bool IsAgbAcknowledged { get; }
|
||||
|
||||
/// <summary>Session cookie used to sign in to copri.</summary>
|
||||
public string SessionCookie { get; }
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace TINK.Model.User.Account
|
|||
public string Mail
|
||||
{
|
||||
get { return m_oAccount.Mail; }
|
||||
set { m_oAccount = new Account(value, m_oAccount.Pwd, m_oAccount.SessionCookie, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
set { m_oAccount = new Account(value, m_oAccount.Pwd, m_oAccount.IsAgbAcknowledged, m_oAccount.SessionCookie, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -38,16 +38,19 @@ namespace TINK.Model.User.Account
|
|||
public string Pwd
|
||||
{
|
||||
get { return m_oAccount.Pwd; }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, value, m_oAccount.SessionCookie, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, value, m_oAccount.IsAgbAcknowledged, m_oAccount.SessionCookie, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
}
|
||||
|
||||
/// <summary>True if user acknowleged agbs.</summary>
|
||||
public bool IsAgbAcknowledged => m_oAccount.IsAgbAcknowledged;
|
||||
|
||||
/// <summary>
|
||||
/// Session cookie used to sign in to copri.
|
||||
/// </summary>
|
||||
public string SessionCookie
|
||||
{
|
||||
get { return m_oAccount.SessionCookie; }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, m_oAccount.Pwd, value, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, m_oAccount.Pwd, m_oAccount.IsAgbAcknowledged, value, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -64,7 +67,7 @@ namespace TINK.Model.User.Account
|
|||
public Permissions DebugLevel
|
||||
{
|
||||
get { return m_oAccount.DebugLevel; }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, m_oAccount.Pwd, m_oAccount.SessionCookie, m_oAccount.Group, value); }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, m_oAccount.Pwd, m_oAccount.IsAgbAcknowledged, m_oAccount.SessionCookie, m_oAccount.Group, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace TINK.Model.User.Account
|
|||
|
||||
public string Pwd => null;
|
||||
|
||||
public bool IsAgbAcknowledged => false;
|
||||
|
||||
public string SessionCookie => null;
|
||||
|
||||
public Permissions DebugLevel => Permissions.None;
|
||||
|
|
|
@ -13,6 +13,9 @@ namespace TINK.Model.User.Account
|
|||
/// <summary>Password of the account.</summary>
|
||||
string Pwd { get; }
|
||||
|
||||
/// <summary>True if user acknowleged agbs.</summary>
|
||||
bool IsAgbAcknowledged { get; }
|
||||
|
||||
/// <summary>Session cookie used to sign in to copri.</summary>
|
||||
string SessionCookie { get; }
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ namespace TINK.Model.User.Account
|
|||
/// <summary> Holds id of the mail address key. </summary>
|
||||
private const string KEY_MAILADDRESS = "MailAddress";
|
||||
|
||||
/// <summary> Holds key for flag is agb acknowledged. </summary>
|
||||
private const string KEY_ISAGBACKNOWLEDGED = "IsAgbAcknowledged";
|
||||
|
||||
public IAccount Delete(IAccount account)
|
||||
{
|
||||
SecureStorage.RemoveAll();
|
||||
|
@ -27,15 +30,16 @@ namespace TINK.Model.User.Account
|
|||
{
|
||||
|
||||
var mail = string.Empty;
|
||||
var isAgbAcknowledged = Account.DEFAULTISAGBACKNOWLEDGED;
|
||||
var sessionCookie = string.Empty;
|
||||
var debugLevel = Permissions.None;
|
||||
|
||||
try
|
||||
{
|
||||
mail = await SecureStorage.GetAsync(KEY_MAILADDRESS);
|
||||
bool.TryParse(await SecureStorage.GetAsync(KEY_ISAGBACKNOWLEDGED), out isAgbAcknowledged);
|
||||
sessionCookie = await SecureStorage.GetAsync(KEY_SESSIONCOOKIE);
|
||||
Enum.TryParse(await SecureStorage.GetAsync(KEY_DEBUGLEVEL), out debugLevel);
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -45,6 +49,7 @@ namespace TINK.Model.User.Account
|
|||
return new Account(
|
||||
mail,
|
||||
string.Empty,
|
||||
isAgbAcknowledged,
|
||||
sessionCookie,
|
||||
new List<string>(),
|
||||
debugLevel);
|
||||
|
@ -55,6 +60,7 @@ namespace TINK.Model.User.Account
|
|||
try
|
||||
{
|
||||
await SecureStorage.SetAsync(KEY_MAILADDRESS, mailAndPwd.Mail);
|
||||
await SecureStorage.SetAsync(KEY_ISAGBACKNOWLEDGED, mailAndPwd.IsAgbAcknowledged.ToString());
|
||||
await SecureStorage.SetAsync(KEY_SESSIONCOOKIE, mailAndPwd.SessionCookie);
|
||||
await SecureStorage.SetAsync(KEY_DEBUGLEVEL, mailAndPwd.DebugLevel.ToString());
|
||||
}
|
||||
|
|
|
@ -476,7 +476,7 @@ namespace TINK.Model
|
|||
AppResources.ChangeLog3_0_266
|
||||
},
|
||||
{
|
||||
new Version(3, 0, 267),
|
||||
new Version(3, 0, 270),
|
||||
AppResources.ChangeLog3_0_231 // Minor improvements.
|
||||
}
|
||||
};
|
||||
|
|
|
@ -767,29 +767,29 @@ namespace TINK.Repository
|
|||
var l_strHost = uRL;
|
||||
|
||||
// Returns a http request.
|
||||
var l_oRequest = WebRequest.CreateHttp(l_strHost);
|
||||
var request = WebRequest.CreateHttp(l_strHost);
|
||||
|
||||
l_oRequest.Method = "POST";
|
||||
l_oRequest.ContentType = "application/x-www-form-urlencoded";
|
||||
l_oRequest.UserAgent = userAgent;
|
||||
request.Method = "POST";
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
request.UserAgent = userAgent;
|
||||
|
||||
// Workaround for issue https://bugzilla.xamarin.com/show_bug.cgi?id=57705
|
||||
// If not KeepAlive is set to true Stream.Write leads arbitrarily to an object disposed exception.
|
||||
l_oRequest.KeepAlive = true;
|
||||
request.KeepAlive = true;
|
||||
|
||||
byte[] l_oPostData = Encoding.UTF8.GetBytes(p_strCommand);
|
||||
|
||||
l_oRequest.ContentLength = l_oPostData.Length;
|
||||
request.ContentLength = l_oPostData.Length;
|
||||
|
||||
// Get the request stream.
|
||||
using (Stream l_oDataStream = await l_oRequest.GetRequestStreamAsync())
|
||||
using (Stream l_oDataStream = await request.GetRequestStreamAsync())
|
||||
{
|
||||
// Write the data to the request stream.
|
||||
await l_oDataStream.WriteAsync(l_oPostData, 0, l_oPostData.Length);
|
||||
}
|
||||
|
||||
// Get the response.
|
||||
var l_oResponse = await l_oRequest.GetResponseAsync() as HttpWebResponse;
|
||||
var l_oResponse = await request.GetResponseAsync() as HttpWebResponse;
|
||||
|
||||
if (l_oResponse == null)
|
||||
{
|
||||
|
|
|
@ -1380,7 +1380,7 @@ namespace TINK.Repository
|
|||
get
|
||||
{
|
||||
var l_iCount = 1;
|
||||
while (GetBikesAvailable(CopriDevelHostUri, TinkApp.MerchantId, p_eSampleSet: ActiveSampleSet, p_lStageIndex: l_iCount) != null)
|
||||
while (GetBikesAvailable(CopriDevelHostUri, MerchantId, p_eSampleSet: ActiveSampleSet, p_lStageIndex: l_iCount) != null)
|
||||
{
|
||||
l_iCount++;
|
||||
}
|
||||
|
|
|
@ -11,5 +11,9 @@ namespace TINK.Repository.Response
|
|||
/// <summary> Holds the group of the bike (TINK, Konrad, ...).</summary>
|
||||
[DataMember]
|
||||
public string[] user_group { get; private set; }
|
||||
|
||||
/// <summary> Holds value of 0 if agb were not acknowledged.</summary>
|
||||
[DataMember]
|
||||
public string agb_checked { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,13 +195,13 @@ namespace TINK.ViewModel.Bikes.Bike
|
|||
case InUseStateEnum.Reserved:
|
||||
return GetReservedInfo(
|
||||
bike.State.RemainingTime,
|
||||
bike.CurrentStation,
|
||||
bike.StationId,
|
||||
null); // Hide reservation code because no one but active user should see code
|
||||
|
||||
case InUseStateEnum.Booked:
|
||||
return GetBookedInfo(
|
||||
bike.State.From,
|
||||
bike.CurrentStation,
|
||||
bike.StationId,
|
||||
null); // Hide reservation code because no one but active user should see code
|
||||
|
||||
default:
|
||||
|
@ -215,7 +215,7 @@ namespace TINK.ViewModel.Bikes.Bike
|
|||
return bike.State.MailAddress == ActiveUser.Mail
|
||||
? GetReservedInfo(
|
||||
bike.State.RemainingTime,
|
||||
bike.CurrentStation,
|
||||
bike.StationId,
|
||||
bike.State.Code)
|
||||
: "Fahrrad bereits reserviert durch anderen Nutzer.";
|
||||
|
||||
|
@ -223,7 +223,7 @@ namespace TINK.ViewModel.Bikes.Bike
|
|||
return bike.State.MailAddress == ActiveUser.Mail
|
||||
? GetBookedInfo(
|
||||
bike.State.From,
|
||||
bike.CurrentStation,
|
||||
bike.StationId,
|
||||
bike.State.Code)
|
||||
: "Fahrrad bereits gebucht durch anderen Nutzer.";
|
||||
|
||||
|
|
|
@ -27,14 +27,11 @@ namespace TINK.ViewModel.Bikes.Bike
|
|||
// No tariff description details available.
|
||||
return string.Empty;
|
||||
|
||||
// Up to version MessageBikesManagementTariffDescriptionTariffHeaderNameId
|
||||
#if USCSHARP9
|
||||
return Tariff?.Number != null
|
||||
? string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeaderNameId, Tariff?.Name ?? "-", Tariff?.Number != null ? Tariff.Number : "-");
|
||||
: string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-");
|
||||
return string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-");
|
||||
#else
|
||||
return Tariff?.Number != null
|
||||
? string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeaderNameId, Tariff?.Name ?? "-", Tariff?.Number != null ? Tariff.Number.ToString() : "-")
|
||||
: string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-");
|
||||
return string.Format(AppResources.MessageBikesManagementTariffDescriptionTariffHeader, Tariff?.Name ?? "-");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
if (!dialogResult)
|
||||
{
|
||||
// User decided not to give access to locations permissions.
|
||||
BikeCollection.Update(bikesAtStation);
|
||||
BikeCollection.Update(bikesAtStation, new List<IStation> { m_oStation});
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -287,7 +287,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
AppResources.MessageBikesManagementLocationActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikesAtStation);
|
||||
BikeCollection.Update(bikesAtStation, new List<IStation> { m_oStation });
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -303,7 +303,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
AppResources.MessageBikesManagementBluetoothActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikesAtStation);
|
||||
BikeCollection.Update(bikesAtStation, new List<IStation> { m_oStation });
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -330,7 +330,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
|
||||
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
|
||||
|
||||
BikeCollection.Update(bikesAtStation.UpdateLockInfo(locksInfo));
|
||||
BikeCollection.Update(bikesAtStation.UpdateLockInfo(locksInfo), new List<IStation> { m_oStation });
|
||||
|
||||
// Backup GUI synchronization context.
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
@ -363,7 +363,7 @@ namespace TINK.ViewModel.BikesAtStation
|
|||
PostAction(
|
||||
unused =>
|
||||
{
|
||||
BikeCollection.Update(bikes);
|
||||
BikeCollection.Update(bikes, new List<IStation> { m_oStation });
|
||||
Exception = result.Exception;
|
||||
ActionText = string.Empty;
|
||||
},
|
||||
|
|
|
@ -508,7 +508,7 @@ namespace TINK.ViewModel.Contact
|
|||
foreach (var stationId in stationsId)
|
||||
{
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.CurrentStation == stationId).ToList();
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value != Model.State.InUseStateEnum.Disposable) != null)
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
|
|
|
@ -4,16 +4,23 @@ namespace TINK.ViewModel.CopriWebView
|
|||
{
|
||||
public class RegisterPageViewModel
|
||||
{
|
||||
/// <summary> Holds the merchant id.</summary>
|
||||
private string MerchantId { get; }
|
||||
|
||||
/// <summary> Holds the name of the host.</summary>
|
||||
private string HostName { get; }
|
||||
|
||||
public RegisterPageViewModel(
|
||||
string merchantId,
|
||||
string hostName)
|
||||
{
|
||||
HostName = hostName;
|
||||
} /// <summary>Get Uri of web view for creating account.</summary>
|
||||
MerchantId = merchantId;
|
||||
}
|
||||
|
||||
/// <summary>Get Uri of web view for creating account.</summary>
|
||||
public string Uri =>
|
||||
$"https://{HostName}/{HostName.GetAppFolderName()}/Account/1.%20Kundendaten";
|
||||
$"https://{HostName}/{HostName.GetAppFolderName()}/Account/1.%20Kundendaten?sessionid={MerchantId}";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ using TINK.Services.Permissions;
|
|||
using Plugin.BLE.Abstractions.Contracts;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Station;
|
||||
|
||||
namespace TINK.ViewModel.FindBike
|
||||
{
|
||||
|
@ -55,6 +56,9 @@ namespace TINK.ViewModel.FindBike
|
|||
/// <summary> Hide id input fields as soon as bike is found.</summary>
|
||||
public bool IsSelectBikeVisible => BikeCollection != null && BikeCollection.Count == 0;
|
||||
|
||||
/// <summary> Holds the stations to get station names form station ids. </summary>
|
||||
private IEnumerable<IStation> Stations { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs bike collection view model in case information about occupied bikes is available.
|
||||
/// </summary>
|
||||
|
@ -66,6 +70,7 @@ namespace TINK.ViewModel.FindBike
|
|||
/// <param name="isConnectedDelegate">Returns if mobile is connected to web or not.</param>
|
||||
/// <param name="connectorFactory">Connects system to copri.</param>
|
||||
/// <param name="lockService">Service to control lock retrieve info.</param>
|
||||
/// <param name="stations">Stations to get station name from station id.</param>
|
||||
/// <param name="polling"> Holds whether to poll or not and the periode leght is polling is on. </param>
|
||||
/// <param name="postAction">Executes actions on GUI thread.</param>
|
||||
/// <param name="smartDevice">Provides info about the smart device (phone, tablet, ...).</param>
|
||||
|
@ -79,6 +84,7 @@ namespace TINK.ViewModel.FindBike
|
|||
Func<bool, IConnector> connectorFactory,
|
||||
IGeolocation geolocation,
|
||||
ILocksService lockService,
|
||||
IEnumerable<IStation> stations,
|
||||
PollingParameters polling,
|
||||
Action<SendOrPostCallback, object> postAction,
|
||||
ISmartDevice smartDevice,
|
||||
|
@ -88,6 +94,8 @@ namespace TINK.ViewModel.FindBike
|
|||
{
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsSelectBikeVisible)));
|
||||
};
|
||||
|
||||
Stations = stations ?? throw new ArgumentException(nameof(stations));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -159,7 +167,7 @@ namespace TINK.ViewModel.FindBike
|
|||
if (!dialogResult)
|
||||
{
|
||||
// User decided not to give access to locations permissions.
|
||||
BikeCollection.Update(bikeCollection);
|
||||
BikeCollection.Update(bikeCollection, Stations);
|
||||
|
||||
//await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -181,7 +189,7 @@ namespace TINK.ViewModel.FindBike
|
|||
AppResources.MessageBikesManagementLocationActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikeCollection);
|
||||
BikeCollection.Update(bikeCollection, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -198,7 +206,7 @@ namespace TINK.ViewModel.FindBike
|
|||
AppResources.MessageBikesManagementBluetoothActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikeCollection);
|
||||
BikeCollection.Update(bikeCollection, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -225,7 +233,7 @@ namespace TINK.ViewModel.FindBike
|
|||
|
||||
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
|
||||
|
||||
BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo));
|
||||
BikeCollection.Update(bikeCollection.UpdateLockInfo(locksInfo), Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -265,7 +273,7 @@ namespace TINK.ViewModel.FindBike
|
|||
PostAction(
|
||||
unused =>
|
||||
{
|
||||
BikeCollection.Update(bikes); // Updating collection leads to update of GUI.
|
||||
BikeCollection.Update(bikes, Stations); // Updating collection leads to update of GUI.
|
||||
Exception = result.Exception;
|
||||
ActionText = string.Empty;
|
||||
},
|
||||
|
|
|
@ -214,6 +214,7 @@ namespace TINK.ViewModel
|
|||
public async Task Login()
|
||||
#endif
|
||||
{
|
||||
IAccount account = new EmptyAccount();
|
||||
try
|
||||
{
|
||||
Log.ForContext<LoginPageViewModel>().Information("User taped login button.");
|
||||
|
@ -223,9 +224,9 @@ namespace TINK.ViewModel
|
|||
TinkApp.ActiveUser.CheckIsPasswordValid(MailAddress, Password);
|
||||
|
||||
// Do login.
|
||||
var l_oAccount = await TinkApp.GetConnector(CrossConnectivity.Current.IsConnected).Command.DoLogin(MailAddress, Password, TinkApp.ActiveUser.DeviceId);
|
||||
account = await TinkApp.GetConnector(CrossConnectivity.Current.IsConnected).Command.DoLogin(MailAddress, Password, TinkApp.ActiveUser.DeviceId);
|
||||
|
||||
await TinkApp.ActiveUser.Login(l_oAccount);
|
||||
await TinkApp.ActiveUser.Login(account);
|
||||
|
||||
// Update map page filter because user might be of both groups TINK an Konrad.
|
||||
TinkApp.GroupFilterMapPage =
|
||||
|
@ -318,7 +319,8 @@ namespace TINK.ViewModel
|
|||
{
|
||||
// No need to show "Anleitung TINK Räder" because user can not use tink.
|
||||
#if USEFLYOUT
|
||||
m_oViewService.ShowPage(ViewTypes.MapPage);
|
||||
|
||||
m_oViewService.ShowPage(account.IsAgbAcknowledged ? ViewTypes.MapPage : ViewTypes.ManageAccountPage);
|
||||
#else
|
||||
await m_oViewService.ShowPage("//MapPage");
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,10 @@ namespace TINK.ViewModel.Map
|
|||
{
|
||||
public class MapPageViewModel : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary> True if message was already shown to user. </summary>
|
||||
private static bool WasMerchantMessageAlreadyShown { get; set; } = false;
|
||||
|
||||
|
||||
/// <summary> Holds the count of custom icons availalbe.</summary>
|
||||
private const int CUSTOM_ICONS_COUNT = 30;
|
||||
|
||||
|
@ -322,6 +326,16 @@ namespace TINK.ViewModel.Map
|
|||
|
||||
TinkApp.Stations = resultStationsAndBikes.Response.StationsAll;
|
||||
|
||||
if (!string.IsNullOrEmpty(resultStationsAndBikes?.GeneralData?.MerchantMessage)
|
||||
&& !WasMerchantMessageAlreadyShown)
|
||||
{
|
||||
await ViewService.DisplayAlert(
|
||||
"Information",
|
||||
resultStationsAndBikes.GeneralData.MerchantMessage,
|
||||
"OK");
|
||||
WasMerchantMessageAlreadyShown = true;
|
||||
}
|
||||
|
||||
await SetStationsOnMap(resultStationsAndBikes.Response.StationsAll);
|
||||
await HandleAuthCookieNotDefinedException(resultStationsAndBikes.Exception);
|
||||
|
||||
|
@ -677,7 +691,7 @@ namespace TINK.ViewModel.Map
|
|||
foreach (var stationId in stationsId)
|
||||
{
|
||||
// Get color of given station.
|
||||
var bikesAtStation = bikesAll.Where(x => x.CurrentStation == stationId).ToList();
|
||||
var bikesAtStation = bikesAll.Where(x => x.StationId == stationId).ToList();
|
||||
if (bikesAtStation.FirstOrDefault(x => x.State.Value != Model.State.InUseStateEnum.Disposable) != null)
|
||||
{
|
||||
// There is at least one requested or booked bike
|
||||
|
|
|
@ -22,11 +22,15 @@ using TINK.Services.Permissions;
|
|||
using Plugin.BLE.Abstractions.Contracts;
|
||||
using TINK.MultilingualResources;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Station;
|
||||
|
||||
namespace TINK.ViewModel.MyBikes
|
||||
{
|
||||
public class MyBikesPageViewModel : BikesViewModel, INotifyCollectionChanged, INotifyPropertyChanged
|
||||
{
|
||||
/// <summary> Holds the stations to get station names form station ids. </summary>
|
||||
private IEnumerable<IStation> Stations { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs bike collection view model in case information about occupied bikes is available.
|
||||
/// </summary>
|
||||
|
@ -38,6 +42,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
/// <param name="isConnectedDelegate">Returns if mobile is connected to web or not.</param>
|
||||
/// <param name="connectorFactory">Connects system to copri.</param>
|
||||
/// <param name="lockService">Service to control lock retrieve info.</param>
|
||||
/// <param name="stations">Stations to get station name from station id.</param>
|
||||
/// <param name="p_oPolling"> Holds whether to poll or not and the periode leght is polling is on. </param>
|
||||
/// <param name="postAction">Executes actions on GUI thread.</param>
|
||||
/// <param name="smartDevice">Provides info about the smart device (phone, tablet, ...).</param>
|
||||
|
@ -51,6 +56,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
Func<bool, IConnector> connectorFactory,
|
||||
IGeolocation geolocation,
|
||||
ILocksService lockService,
|
||||
IEnumerable<IStation> stations,
|
||||
PollingParameters p_oPolling,
|
||||
Action<SendOrPostCallback, object> postAction,
|
||||
ISmartDevice smartDevice,
|
||||
|
@ -61,6 +67,8 @@ namespace TINK.ViewModel.MyBikes
|
|||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsNoBikesOccupiedVisible)));
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(NoBikesOccupiedText)));
|
||||
};
|
||||
|
||||
Stations = stations ?? throw new ArgumentException(nameof(stations));
|
||||
}
|
||||
|
||||
/// <summary> Returns if info about the fact that user did not request or book any bikes is visible or not.<summary>
|
||||
|
@ -134,7 +142,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
if (!dialogResult)
|
||||
{
|
||||
// User decided not to give access to locations permissions.
|
||||
BikeCollection.Update(bikesOccupied.Response);
|
||||
BikeCollection.Update(bikesOccupied.Response, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -156,7 +164,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
AppResources.MessageBikesManagementLocationActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikesOccupied.Response);
|
||||
BikeCollection.Update(bikesOccupied.Response, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -173,7 +181,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
AppResources.MessageBikesManagementBluetoothActivation,
|
||||
AppResources.MessageAnswerOk);
|
||||
|
||||
BikeCollection.Update(bikesOccupied.Response);
|
||||
BikeCollection.Update(bikesOccupied.Response, Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -200,7 +208,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
|
||||
var locksInfo = lockIdList.UpdateById(locksInfoTdo);
|
||||
|
||||
BikeCollection.Update(bikesOccupied.Response.UpdateLockInfo(locksInfo));
|
||||
BikeCollection.Update(bikesOccupied.Response.UpdateLockInfo(locksInfo), Stations);
|
||||
|
||||
await OnAppearing(() => UpdateTask());
|
||||
|
||||
|
@ -251,7 +259,7 @@ namespace TINK.ViewModel.MyBikes
|
|||
PostAction(
|
||||
unused =>
|
||||
{
|
||||
BikeCollection.Update(bikes); // Updating collection leads to update of GUI.
|
||||
BikeCollection.Update(bikes, Stations); // Updating collection leads to update of GUI.
|
||||
Exception = result.Exception;
|
||||
ActionText = string.Empty;
|
||||
},
|
||||
|
|
|
@ -158,21 +158,20 @@ namespace TestFramework.Repository
|
|||
public bool IsConnected => false;
|
||||
|
||||
/// <summary> Logs user in. </summary>
|
||||
/// <param name="p_oUser">User to log in.</param>
|
||||
/// <param name="p_strDeviceId">Id specifying user and hardware.</param>
|
||||
/// <param name="p_strMailAddress">Mailaddress of user to log in.</param>
|
||||
/// <param name="p_strPassword">Password to log in.</param>
|
||||
/// <param name="deviceId">Id specifying user and hardware.</param>
|
||||
/// <param name="mailAddress">Mailaddress of user to log in.</param>
|
||||
/// <param name="password">Password to log in.</param>
|
||||
/// <remarks>Response which holds auth cookie <see cref="ResponseBase.authcookie"/></remarks>
|
||||
public static AuthorizationResponse DoAuthorize(
|
||||
string DoAuthResponse,
|
||||
string p_strMailAddress,
|
||||
string p_strPassword,
|
||||
string p_strDeviceId)
|
||||
string doAuthResponse,
|
||||
string mailAddress,
|
||||
string password,
|
||||
string deviceId)
|
||||
{
|
||||
return p_strMailAddress == "javaminister@gmail.com"
|
||||
&& p_strPassword == "*********" &&
|
||||
p_strDeviceId == "HwId1000000000000"
|
||||
? JsonConvertRethrow.DeserializeObject<ResponseContainer<AuthorizationResponse>>(DoAuthResponse).shareejson
|
||||
return mailAddress == "javaminister@gmail.com"
|
||||
&& password == "*********" &&
|
||||
deviceId == "HwId1000000000000"
|
||||
? JsonConvertRethrow.DeserializeObject<ResponseContainer<AuthorizationResponse>>(doAuthResponse).shareejson
|
||||
: JsonConvertRethrow.DeserializeObject<ResponseContainer<AuthorizationResponse>>(DO_AUTH_Unknown_User_FILE).shareejson;
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001()),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001()),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -98,7 +98,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new Account("javaminister@gmail.com", "javaminister" /* password */, "4da3044c8657a04ba60e2eaa753bc51a" /* session cookie */, new List<string> { FilterHelper.FILTERTINKGENERAL, FilterHelper.FILTERKONRAD })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001("6103_112e96b36ba33de245943c5ffaf369cd_")),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001("6103_112e96b36ba33de245943c5ffaf369cd_")),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -159,7 +159,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new Account("mgrimm@gmail.com", "123456789" /* password */, "1234" /* session cookie */, new List<string> { FilterHelper.FILTERTINKGENERAL, FilterHelper.FILTERKONRAD })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001()),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001()),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -214,7 +214,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new Account("mgrimm@gmail.com", "123456789" /* password */, "1234" /* session cookie */, new List<string> { FilterHelper.FILTERTINKGENERAL, FilterHelper.FILTERKONRAD })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001()),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001()),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -270,7 +270,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
null, // use default locks service
|
||||
new DeviceMock(),
|
||||
|
@ -313,7 +313,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
null, // use default locks service
|
||||
new DeviceMock(),
|
||||
|
@ -358,7 +358,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(TINK.Services.BluetoothLock.BLE.LockItByGuidService).FullName,
|
||||
activeGeolocationService: typeof(TINK.Model.Services.Geolocation.LastKnownGeolocationService).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
null, // use default locks service
|
||||
new DeviceMock(),
|
||||
|
|
|
@ -19,11 +19,12 @@ namespace TestTINKLib
|
|||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string currentStationId = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, currentStationId, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +44,7 @@ namespace TestTINKLib
|
|||
Assert.AreEqual(WheelType.Two, l_oBike.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBike.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBike.State.Value);
|
||||
Assert.IsNull(l_oBike.CurrentStation);
|
||||
Assert.IsNull(l_oBike.StationId);
|
||||
|
||||
l_oBike = new BikeInfoMutable(
|
||||
"17",
|
||||
|
@ -59,7 +60,7 @@ namespace TestTINKLib
|
|||
Assert.AreEqual(WheelType.Mono, l_oBike.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Allround, l_oBike.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBike.State.Value);
|
||||
Assert.AreEqual("1", l_oBike.CurrentStation);
|
||||
Assert.AreEqual("1", l_oBike.StationId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
public void TestCtorAvailable()
|
||||
{
|
||||
Assert.AreEqual ("12",new BikeInfo("12", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").Id);
|
||||
Assert.AreEqual("13", new BikeInfo("12", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").CurrentStation);
|
||||
Assert.AreEqual("13", new BikeInfo("12", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").StationId);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, new BikeInfo("12", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").State.Value);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using TINK.Model.Bike.BluetoothLock;
|
||||
|
||||
namespace TestShareeLib.Model.Bike.BluetoothLock
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestBikeInfoMutalbe
|
||||
{
|
||||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
Assert.That(
|
||||
new BikeInfoMutable(new BikeInfo("MyBikeId", 42, new Guid(), "17"), "My Station Name").StationName,
|
||||
Is.EqualTo("My Station Name"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,9 +4,8 @@ using System.Collections.Generic;
|
|||
using TINK.Model.Bike;
|
||||
using TINK.Model.Bikes.Bike;
|
||||
using TINK.Model.State;
|
||||
|
||||
using TINK.Model.Station;
|
||||
using BikeInfo = TINK.Model.Bike.BC.BikeInfo;
|
||||
using BikeInfoMutable = TINK.Model.Bike.BC.BikeInfoMutable;
|
||||
|
||||
namespace TestTINKLib
|
||||
{
|
||||
|
@ -23,11 +22,12 @@ namespace TestTINKLib
|
|||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string currentStationId = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, currentStationId, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace TestTINKLib
|
|||
Assert.AreEqual(InUseStateEnum.Reserved, l_oBikeColl.GetById("20").State.Value);
|
||||
Assert.Null(l_oBikeColl.GetById("33"));
|
||||
|
||||
l_oBikeColl.Update(null);
|
||||
l_oBikeColl.Update(null, null );
|
||||
|
||||
// Verify modified state
|
||||
Assert.Null(l_oBikeColl.GetById("63"));
|
||||
|
@ -74,36 +74,114 @@ namespace TestTINKLib
|
|||
[Test]
|
||||
public void TestUpdate()
|
||||
{
|
||||
var l_oBikeRequested = new BikeInfoMutable("20", false, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Allround);
|
||||
l_oBikeRequested.State.Load(new StateInfo(() => DateTime.Now, DateTime.Now, "john@long", "1234"));
|
||||
var bikeRequested = new BikeInfoMutable("20", false, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Allround);
|
||||
bikeRequested.State.Load(new StateInfo(() => DateTime.Now, DateTime.Now, "john@long", "1234"));
|
||||
|
||||
var l_oBikeColl = new BikeCollectionMutable
|
||||
var bikeColl = new BikeCollectionMutable
|
||||
{
|
||||
new BikeInfoMutable("63", false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Allround),
|
||||
new BikeInfoMutable("57", false, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Cargo),
|
||||
l_oBikeRequested,
|
||||
bikeRequested,
|
||||
};
|
||||
|
||||
// Verify initial state
|
||||
Assert.NotNull(l_oBikeColl.GetById("63")); // Will be removed
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeColl.GetById("57").State.Value); // Will be requested
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, l_oBikeColl.GetById("20").State.Value); // Will be booked
|
||||
Assert.Null(l_oBikeColl.GetById("33")); //
|
||||
Assert.NotNull(bikeColl.GetById("63")); // Will be removed
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, bikeColl.GetById("57").State.Value); // Will be requested
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, bikeColl.GetById("20").State.Value); // Will be booked
|
||||
Assert.Null(bikeColl.GetById("33")); //
|
||||
|
||||
var l_oBikeResponse = new List<BikeInfo>
|
||||
{
|
||||
new BikeInfo("57", false, new List<string> {"TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", "7", null /*operator uri*/, null, DateTime.Now, "john@long,", "1234"),
|
||||
new BikeInfo("57" /* bike id*/, false, new List<string> {"TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", "7" /*station id*/, null /*operator uri*/, null, DateTime.Now, "john@long,", "1234"),
|
||||
new BikeInfo("20", false, new List<string> {"TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", "7", null /*operator uri*/, null, DateTime.Now, "john@long,", "1234"),
|
||||
new BikeInfo("33", "7", null /*operator uri*/, null, false, new List<string> {"TINK" }, WheelType.Trike, TypeOfBike.Allround),
|
||||
};
|
||||
|
||||
l_oBikeColl.Update(l_oBikeResponse);
|
||||
|
||||
bikeColl.Update(l_oBikeResponse, new List<IStation>());
|
||||
|
||||
// Verify modified state
|
||||
Assert.Null(l_oBikeColl.GetById("63"));
|
||||
Assert.AreEqual(InUseStateEnum.Booked, l_oBikeColl.GetById("57").State.Value);
|
||||
Assert.AreEqual(InUseStateEnum.Booked, l_oBikeColl.GetById("20").State.Value);
|
||||
Assert.NotNull(l_oBikeColl.GetById("33"));
|
||||
Assert.Null(bikeColl.GetById("63"), "Bike not contained in response must not exist.");
|
||||
Assert.AreEqual(InUseStateEnum.Booked, bikeColl.GetById("57").State.Value);
|
||||
Assert.AreEqual(InUseStateEnum.Booked, bikeColl.GetById("20").State.Value);
|
||||
Assert.NotNull(bikeColl.GetById("33"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bike for which station name is updated is not contained in bike collection when calling update.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestUpdate_StationName_NewBike()
|
||||
{
|
||||
var bikeColl = new BikeCollectionMutable();
|
||||
|
||||
// Verify initial state
|
||||
Assert.That(bikeColl.GetById("57"), Is.Null);
|
||||
|
||||
var l_oBikeResponse = new List<BikeInfo>
|
||||
{
|
||||
new BikeInfo("57" /* bike id*/, false, new List<string> {"TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", "7" /*station id*/, null /*operator uri*/, null, DateTime.Now, "john@long,", "1234"),
|
||||
};
|
||||
|
||||
var stations = new List<IStation>
|
||||
{
|
||||
new Station("7", new List<string>(), null, "My facy station")
|
||||
};
|
||||
|
||||
bikeColl.Update(l_oBikeResponse, stations);
|
||||
|
||||
// Verify modified state
|
||||
Assert.That(bikeColl.GetById("57").StationId, Is.EqualTo("7"));
|
||||
Assert.That(bikeColl.GetById("57").StationName, Is.EqualTo("My facy station"));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestUpdate_StationName_UpdateExistingBike()
|
||||
{
|
||||
|
||||
var bikeColl = new BikeCollectionMutable
|
||||
{
|
||||
new BikeInfoMutable("57", false, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Cargo),
|
||||
};
|
||||
|
||||
// Verify initial state
|
||||
Assert.That(bikeColl.GetById("57"), Is.Not.Null);
|
||||
|
||||
var bikeResponse = new List<BikeInfo>
|
||||
{
|
||||
new BikeInfo("57" /* bike id*/, false, new List<string> {"TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", "7" /*station id*/, null /*operator uri*/, null, DateTime.Now, "john@long,", "1234"),
|
||||
};
|
||||
|
||||
var stations = new List<IStation>
|
||||
{
|
||||
new Station("7", new List<string>(), null, "My facy station")
|
||||
};
|
||||
|
||||
bikeColl.Update(bikeResponse, stations);
|
||||
|
||||
// Verify modified state
|
||||
Assert.That(bikeColl.GetById("57").StationId, Is.Null, "Station id is only set when update creates BikeInfo object, not when updating object BikeInfo because station name does not change.");
|
||||
Assert.That(bikeColl.GetById("57").StationName, Is.Null, "Station name is only set when update creates BikeInfo object, not when updating object BikeInfo because station name does not change.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpdate_StationName_Nullstations()
|
||||
{
|
||||
|
||||
var bikeColl = new BikeCollectionMutable();
|
||||
|
||||
|
||||
var l_oBikeResponse = new List<BikeInfo>
|
||||
{
|
||||
new BikeInfo("57" /* bike id*/, false, new List<string> {"TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", "7" /*station id*/, null /*operator uri*/, null, DateTime.Now, "john@long,", "1234"),
|
||||
};
|
||||
|
||||
bikeColl.Update(l_oBikeResponse, null);
|
||||
|
||||
// Verify modified state
|
||||
Assert.That(bikeColl.GetById("57").StationId, Is.EqualTo("7"));
|
||||
Assert.That(bikeColl.GetById("57").StationName, Is.EqualTo(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
Assert.That(btBikeReserved.TariffDescription.MaxFeeEuroPerDay, Is.EqualTo(10));
|
||||
Assert.That(btBikeReserved.TariffDescription.Number, Is.EqualTo(5494));
|
||||
Assert.That(btBikeReserved.TariffDescription.Name, Is.EqualTo("Tester Basic"));
|
||||
Assert.That(btBikeReserved.CurrentStation, Is.EqualTo("FR_103"));
|
||||
Assert.That(btBikeReserved.StationId, Is.EqualTo("FR_103"));
|
||||
Assert.That(btBikeReserved.LockInfo.Id, Is.EqualTo(2302373));
|
||||
Assert.That(btBikeReserved.OperatorUri.AbsoluteUri, Does.Contain("https://shareeapp-fr01.copri.eu"));
|
||||
Assert.That(btBikeReserved.Group.Count, Is.EqualTo(1));
|
||||
|
@ -373,7 +373,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
Assert.That(btBikeRented.TariffDescription.MaxFeeEuroPerDay, Is.EqualTo(10));
|
||||
Assert.That(btBikeRented.TariffDescription.Number, Is.EqualTo(5494));
|
||||
Assert.That(btBikeRented.TariffDescription.Name, Is.EqualTo("Tester Basic"));
|
||||
Assert.That(btBikeRented.CurrentStation, Is.EqualTo("103"));
|
||||
Assert.That(btBikeRented.StationId, Is.EqualTo("103"));
|
||||
Assert.That(btBikeRented.LockInfo.Id, Is.EqualTo(2200537));
|
||||
Assert.That(btBikeRented.OperatorUri.AbsoluteUri, Does.Contain("https://shareeapp-fr01.copri.eu"));
|
||||
Assert.That(btBikeRented.Group.Count, Is.EqualTo(1));
|
||||
|
@ -678,7 +678,8 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
null, /*group*/
|
||||
null, /*wheelType*/
|
||||
null, /*typeOfBike*/
|
||||
null /*description*/));
|
||||
null /*description*/),
|
||||
"My Station Name");
|
||||
|
||||
var response = JsonConvert.DeserializeObject<BikeInfoReservedOrBooked>(@"
|
||||
{
|
||||
|
@ -711,7 +712,8 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
DateTime.Now,
|
||||
"a@b",
|
||||
"1",
|
||||
null /*operator uri*/));
|
||||
null /*operator uri*/),
|
||||
"My Station Name");
|
||||
|
||||
var response = JsonConvert.DeserializeObject<BikeInfoReservedOrBooked>(@"
|
||||
{
|
||||
|
@ -751,7 +753,8 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
null, /*group*/
|
||||
null, /*wheelType*/
|
||||
null, /*typeOfBike*/
|
||||
null /*description*/));
|
||||
null /*description*/),
|
||||
"My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, bike.State.Value);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ using Plugin.Permissions.Abstractions;
|
|||
|
||||
using TestShareeLib.Repository;
|
||||
using TestFramework.Repository;
|
||||
using TINK.Repository;
|
||||
|
||||
namespace TestTINKLib.Fixtures.UseCases.Logout
|
||||
{
|
||||
|
@ -42,8 +43,9 @@ namespace TestTINKLib.Fixtures.UseCases.Logout
|
|||
activeUri: new Uri(CopriServerUriList.TINK_DEVEL)),
|
||||
accountStore,
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => string.IsNullOrEmpty(sessionCookie)
|
||||
? new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001())
|
||||
: new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
? new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001())
|
||||
: new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
device,
|
||||
|
|
|
@ -12,6 +12,7 @@ using TINK.Model.User.Account;
|
|||
using Plugin.Permissions.Abstractions;
|
||||
using System.Threading.Tasks;
|
||||
using TestFramework.Repository;
|
||||
using TINK.Repository;
|
||||
|
||||
namespace TestShareeLib.UseCases.Login
|
||||
{
|
||||
|
@ -28,15 +29,16 @@ namespace TestShareeLib.UseCases.Login
|
|||
var permissions = Substitute.For<IPermissions>();
|
||||
|
||||
// No user logged in is initial state to verify.
|
||||
var l_oTinkApp = new TinkApp(
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: "NotRelevantActiveGeoloactionServiceName",
|
||||
activeUri: new Uri(CopriServerUriList.TINK_DEVEL)),
|
||||
accountStore,
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => string.IsNullOrEmpty(sessionCookie)
|
||||
? new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001()) as IConnector
|
||||
: new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
? new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001())
|
||||
: new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
device,
|
||||
|
@ -47,31 +49,32 @@ namespace TestShareeLib.UseCases.Login
|
|||
currentVersion: new Version(3, 2, 0, 115),
|
||||
lastVersion: new Version(3, 0, 173) /* Current app version. Must be larger or equal 3.0.173 to lastVersion*/);
|
||||
|
||||
Assert.IsFalse(l_oTinkApp.ActiveUser.IsLoggedIn);
|
||||
// Verifiy initial state.
|
||||
Assert.IsFalse(tinkApp.ActiveUser.IsLoggedIn);
|
||||
Assert.AreEqual(
|
||||
8,
|
||||
l_oTinkApp.GetConnector(true).Query.GetBikesAsync().Result.Response.Count,
|
||||
tinkApp.GetConnector(true).Query.GetBikesAsync().Result.Response.Count,
|
||||
"Sum of bikes is 6 occupied, no one occupied because no user is logged in");
|
||||
Assert.AreEqual(
|
||||
0,
|
||||
l_oTinkApp.GetConnector(true).Query.GetBikesOccupiedAsync().Result.Response.Count,
|
||||
tinkApp.GetConnector(true).Query.GetBikesOccupiedAsync().Result.Response.Count,
|
||||
"If no user is logged in no occupied bikes are shown.");
|
||||
Assert.IsNull(l_oTinkApp.GetConnector(true).Command.SessionCookie);
|
||||
Assert.IsNull(tinkApp.GetConnector(true).Command.SessionCookie);
|
||||
|
||||
// Log user out.
|
||||
var l_oAccount = l_oTinkApp.GetConnector(true).Command.DoLogin("javaminister@gmail.com", "*********", "HwId1000000000000").Result;
|
||||
await l_oTinkApp.ActiveUser.Login(l_oAccount);
|
||||
// Log in user.
|
||||
var account = tinkApp.GetConnector(true).Command.DoLogin("javaminister@gmail.com", "*********", "HwId1000000000000").Result;
|
||||
await tinkApp.ActiveUser.Login(account);
|
||||
|
||||
Assert.IsTrue(l_oTinkApp.ActiveUser.IsLoggedIn);
|
||||
Assert.IsTrue(tinkApp.ActiveUser.IsLoggedIn);
|
||||
Assert.AreEqual(
|
||||
10,
|
||||
l_oTinkApp.GetConnector(true).Query.GetBikesAsync().Result.Response.Count,
|
||||
tinkApp.GetConnector(true).Query.GetBikesAsync().Result.Response.Count,
|
||||
"Sum of bikes is 6 occupied plus 2 occupied.");
|
||||
Assert.AreEqual(
|
||||
2,
|
||||
l_oTinkApp.GetConnector(true).Query.GetBikesOccupiedAsync().Result.Response.Count,
|
||||
tinkApp.GetConnector(true).Query.GetBikesOccupiedAsync().Result.Response.Count,
|
||||
"Javaminster occupies 2 bikes.");
|
||||
Assert.AreEqual("6103_112e96b36ba33de245943c5ffaf369cd_", l_oTinkApp.GetConnector(true).Command.SessionCookie);
|
||||
Assert.AreEqual("6103_112e96b36ba33de245943c5ffaf369cd_oiF2kahH", tinkApp.GetConnector(true).Command.SessionCookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,34 @@
|
|||
using NUnit.Framework;
|
||||
using NSubstitute;
|
||||
using NSubstitute.ExceptionExtensions;
|
||||
using NUnit.Framework;
|
||||
using Plugin.BLE.Abstractions.Contracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TestFramework.Model.Device;
|
||||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Repository;
|
||||
using TestFramework.Services.CopriApi.Connector;
|
||||
using TestFramework.Services.Permissions;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.View;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Model.Services.Geolocation;
|
||||
using TINK.Repository;
|
||||
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
using TINK.ViewModel.Map;
|
||||
using TINK.ViewModel.Settings;
|
||||
using Plugin.BLE.Abstractions.Contracts;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Services;
|
||||
using TINK.Services.BluetoothLock;
|
||||
using NSubstitute;
|
||||
using TINK.ViewModel.BikesAtStation;
|
||||
using Xamarin.Forms;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
using TINK.Services.Permissions;
|
||||
using TINK.Model.Services.Geolocation;
|
||||
using NSubstitute.ExceptionExtensions;
|
||||
using TINK.Services;
|
||||
using TINK.Model.Device;
|
||||
using TestFramework.Model.Device;
|
||||
using TestFramework.Repository;
|
||||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Services.Permissions;
|
||||
using TestFramework.Services.CopriApi.Connector;
|
||||
using TINK.View;
|
||||
using TINK.ViewModel.BikesAtStation;
|
||||
using TINK.ViewModel.Map;
|
||||
using TINK.ViewModel.Settings;
|
||||
using Xamarin.Forms;
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
||||
{
|
||||
|
@ -48,15 +47,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.Off } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.Off }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("", null, null, new List<string>())),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("", null, false, null, new List<string>())),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -127,8 +127,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -204,8 +205,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation, // Instance geolocation mocks both parts
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -257,8 +259,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
var bike1315 = bikesAtStation.FirstOrDefault(x => x.Id == "1315") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1543 = bikesAtStation.FirstOrDefault(x => x.Id == "1543") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Available.", bike1315.StateText);
|
||||
Assert.AreEqual("Available.", bike1543.StateText);
|
||||
Assert.AreEqual("Close lock", bike1545.LockitButtonText);
|
||||
|
@ -296,6 +298,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
}
|
||||
);
|
||||
|
||||
bluetooth.State.Returns(BluetoothState.On);
|
||||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.Off } }),
|
||||
|
@ -305,8 +309,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -363,8 +368,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
var bike1315 = bikesAtStation.FirstOrDefault(x => x.Id == "1315") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1543 = bikesAtStation.FirstOrDefault(x => x.Id == "1543") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Available.", bike1315.StateText);
|
||||
Assert.AreEqual("Available.", bike1543.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
|
@ -412,8 +417,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -469,8 +475,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
var bike1315 = bikesAtStation.FirstOrDefault(x => x.Id == "1315") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1543 = bikesAtStation.FirstOrDefault(x => x.Id == "1543") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Available.", bike1315.StateText);
|
||||
Assert.AreEqual("Available.", bike1543.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
|
@ -516,8 +522,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -571,8 +578,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
var bike1315 = bikesAtStation.FirstOrDefault(x => x.Id == "1315") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1543 = bikesAtStation.FirstOrDefault(x => x.Id == "1543") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Available.", bike1315.StateText);
|
||||
Assert.AreEqual("Available.", bike1543.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
|
@ -618,8 +625,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -674,8 +682,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
var bike1315 = bikesAtStation.FirstOrDefault(x => x.Id == "1315") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1543 = bikesAtStation.FirstOrDefault(x => x.Id == "1543") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Available.", bike1315.StateText);
|
||||
Assert.AreEqual("Available.", bike1543.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
|
@ -705,7 +713,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.Off }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
|
@ -713,7 +721,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -786,7 +795,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -846,7 +856,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.Off } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.Off }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
|
@ -856,9 +866,11 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
new StoreMock(new TINK.Model.User.Account.Account(
|
||||
LoginSessionCopriInfo.JavaministerHardwareNr1.Mail,
|
||||
LoginSessionCopriInfo.JavaministerHardwareNr1.Pwd,
|
||||
false,
|
||||
"6103_112e96b36ba33de245943c5ffaf369cd_", // Was 4da3044c8657a04ba60e2eaa753bc51a before switching from data provider CopriCallsMemory(SampleSets.Set2, 1, ...)
|
||||
new List<string> { FilterHelper.CARGOBIKE })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -899,7 +911,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR9999").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR9999").StateText);
|
||||
Assert.AreEqual("Max. reservation time of 15 minutes expired.", bikesAtStation.FirstOrDefault(x => x.Id == "FR1004").StateText);
|
||||
Assert.AreEqual("Rented since 06. November 18:57.", bikesAtStation.FirstOrDefault(x => x.Id == "FR1544").StateText); // Was 7
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2021-11-06 18:57:25.445447+01"):dd. MMMM HH:mm}.", bikesAtStation.FirstOrDefault(x => x.Id == "FR1544").StateText); // Was 7
|
||||
|
||||
// Login hint/ no bikes frame
|
||||
Assert.IsFalse(bikesAtStation.IsLoginRequiredHintVisible);
|
||||
|
@ -923,7 +935,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.Off } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.Off }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
|
@ -931,7 +943,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -994,7 +1007,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.Off } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.Off }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
|
@ -1014,6 +1027,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -1079,7 +1093,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.Off } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.Off }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.CARGOBIKE, FilterState.On }, { FilterHelper.CITYBIKE, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000),
|
||||
|
@ -1100,6 +1114,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
|
@ -1,20 +0,0 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model.Bike.BC;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Bike.BC
|
||||
{
|
||||
/// <summary>
|
||||
/// Moved to TestShareeLib (.Net Core)
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class TestBikeInfo
|
||||
{
|
||||
[Test]
|
||||
public void TestCtorCopyNull()
|
||||
{
|
||||
Assert.Throws<System.ArgumentException>(
|
||||
() => new BikeInfo(null),
|
||||
"Verify that no unspecific reference not set to... exception is thrown");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,11 +22,12 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string currentStationId = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, currentStationId, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +37,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
{
|
||||
var l_oBikeInfo = new BikeInfoMutable("17");
|
||||
Assert.AreEqual("17", l_oBikeInfo.Id);
|
||||
Assert.IsNull(l_oBikeInfo.CurrentStation);
|
||||
Assert.IsNull(l_oBikeInfo.StationId);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual(null, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(null, l_oBikeInfo.TypeOfBike);
|
||||
|
@ -44,7 +45,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
l_oBikeInfo = new BikeInfoMutable("22", false, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Cargo, "Test description", "23");
|
||||
Assert.AreEqual("22", l_oBikeInfo.Id);
|
||||
Assert.IsFalse(l_oBikeInfo.IsDemo);
|
||||
Assert.AreEqual("23", l_oBikeInfo.CurrentStation);
|
||||
Assert.AreEqual("23", l_oBikeInfo.StationId);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
|
||||
|
@ -60,18 +61,19 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
l_oBikeInfoMock.Stub(x => x.Id).Return("22");
|
||||
l_oBikeInfoMock.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo);
|
||||
l_oBikeInfoMock.Stub(x => x.WheelType).Return(WheelType.Trike);
|
||||
l_oBikeInfoMock.Stub(x => x.CurrentStation).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.StationId).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.State).Return(l_oStateInfoMock);
|
||||
l_oStateInfoMock.Stub(x => x.Value).Return(InUseStateEnum.Booked);
|
||||
l_oStateInfoMock.Stub(x => x.From).Return(new System.DateTime(2018, 01, 03));
|
||||
l_oStateInfoMock.Stub(x => x.MailAddress).Return("a@b");
|
||||
l_oStateInfoMock.Stub(x => x.Code).Return("234");
|
||||
|
||||
var l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock);
|
||||
var l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock, "My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Booked, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual("22", l_oBikeInfo.Id);
|
||||
Assert.AreEqual("23", l_oBikeInfo.CurrentStation);
|
||||
Assert.AreEqual("23", l_oBikeInfo.StationId);
|
||||
Assert.AreEqual("My Station Name", l_oBikeInfo.StationName);
|
||||
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Booked, l_oBikeInfo.State.Value);
|
||||
|
@ -85,18 +87,18 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
l_oBikeInfoMock.Stub(x => x.Id).Return("22");
|
||||
l_oBikeInfoMock.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo);
|
||||
l_oBikeInfoMock.Stub(x => x.WheelType).Return(WheelType.Trike);
|
||||
l_oBikeInfoMock.Stub(x => x.CurrentStation).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.StationId).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.State).Return(l_oStateInfoMock);
|
||||
l_oStateInfoMock.Stub(x => x.Value).Return(InUseStateEnum.Reserved);
|
||||
l_oStateInfoMock.Stub(x => x.From).Return(new System.DateTime(2018, 01, 03));
|
||||
l_oStateInfoMock.Stub(x => x.MailAddress).Return("a@b");
|
||||
l_oStateInfoMock.Stub(x => x.Code).Return("234");
|
||||
|
||||
l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock);
|
||||
l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock, "My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual("22", l_oBikeInfo.Id);
|
||||
Assert.AreEqual("23", l_oBikeInfo.CurrentStation);
|
||||
Assert.AreEqual("23", l_oBikeInfo.StationId);
|
||||
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, l_oBikeInfo.State.Value);
|
||||
|
@ -110,15 +112,15 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
l_oBikeInfoMock.Stub(x => x.Id).Return("22");
|
||||
l_oBikeInfoMock.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo);
|
||||
l_oBikeInfoMock.Stub(x => x.WheelType).Return(WheelType.Trike);
|
||||
l_oBikeInfoMock.Stub(x => x.CurrentStation).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.StationId).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.State).Return(l_oStateInfoMock);
|
||||
l_oStateInfoMock.Stub(x => x.Value).Return(InUseStateEnum.Disposable);
|
||||
|
||||
l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock);
|
||||
l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock, "My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual("22", l_oBikeInfo.Id);
|
||||
Assert.AreEqual("23", l_oBikeInfo.CurrentStation);
|
||||
Assert.AreEqual("23", l_oBikeInfo.StationId);
|
||||
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeInfo.State.Value);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository;
|
||||
|
||||
|
@ -18,6 +19,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
|
||||
// Construct not logged in version of connector.
|
||||
var l_oCommand = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
"", // Not logged in
|
||||
"",
|
||||
l_oCopri).Command;
|
||||
|
@ -34,6 +36,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
||||
|
||||
var l_oCommand = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
"123", // Logged in
|
||||
"a@b",
|
||||
l_oCopri).Command;
|
||||
|
@ -50,6 +53,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
||||
|
||||
var l_oQuery = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
"",
|
||||
"",
|
||||
l_oCopri).Query;
|
||||
|
@ -66,6 +70,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
||||
|
||||
var l_oQuery = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
"123",
|
||||
"a@b",
|
||||
l_oCopri).Query;
|
||||
|
|
|
@ -5,6 +5,7 @@ using TINK.Model.Connector;
|
|||
using System.Linq;
|
||||
using TINK.Repository;
|
||||
using TestFramework.Repository;
|
||||
using System;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
||||
{
|
||||
|
@ -17,6 +18,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
public void TestGetStationsAll()
|
||||
{
|
||||
var connector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory001());
|
||||
|
@ -51,6 +53,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
public void TestGetBikesAll()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory001());
|
||||
|
|
|
@ -614,5 +614,56 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
() => version.GetCopriVersion(),
|
||||
Throws.InstanceOf<InvalidResponseException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""agb_checked"" : ""1""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged_No()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""agb_checked"" : ""0""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged_Invalid()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""agb_checked"" : ""ä""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged_Empty()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace UITest.Fixtures.ObjectTests.User.Account
|
|||
var account = new TINK.Model.User.Account.Account(
|
||||
"hans.musterman@hotmail.com", // Mail
|
||||
"myPasswd", // Pwd
|
||||
false,
|
||||
"aktuellerKeks", // Cookie
|
||||
new List<string> { "Honkey", "Tonkey" }, // Group
|
||||
TINK.Model.User.Account.Permissions.None);
|
||||
|
@ -21,6 +22,7 @@ namespace UITest.Fixtures.ObjectTests.User.Account
|
|||
// Assert
|
||||
Assert.AreEqual("hans.musterman@hotmail.com", account.Mail);
|
||||
Assert.AreEqual("myPasswd", account.Pwd);
|
||||
Assert.That(account.IsAgbAcknowledged, Is.False);
|
||||
Assert.AreEqual("aktuellerKeks", account.SessionCookie);
|
||||
Assert.AreEqual("Honkey,Tonkey", String.Join(",", account.Group));
|
||||
Assert.AreEqual(TINK.Model.User.Account.Permissions.None, account.DebugLevel);
|
||||
|
@ -29,19 +31,26 @@ namespace UITest.Fixtures.ObjectTests.User.Account
|
|||
[Test]
|
||||
public void TestConstruct_Copy()
|
||||
{
|
||||
var l_oAccount = new TINK.Model.User.Account.Account(new TINK.Model.User.Account.Account("a@b", "112", "3330", new List<string> { "Honkey", "Tonkey" },TINK.Model.User.Account.Permissions.None));
|
||||
var account = new TINK.Model.User.Account.Account(new TINK.Model.User.Account.Account(
|
||||
"a@b",
|
||||
"112",
|
||||
true, // Agbs have been acknowledged
|
||||
"3330",
|
||||
new List<string> { "Honkey", "Tonkey" },
|
||||
TINK.Model.User.Account.Permissions.None));
|
||||
|
||||
Assert.AreEqual("a@b", l_oAccount.Mail);
|
||||
Assert.AreEqual("112", l_oAccount.Pwd);
|
||||
Assert.AreEqual("3330", l_oAccount.SessionCookie);
|
||||
Assert.AreEqual("Honkey,Tonkey", String.Join(",", l_oAccount.Group));
|
||||
Assert.AreEqual(TINK.Model.User.Account.Permissions.None, l_oAccount.DebugLevel);
|
||||
Assert.AreEqual("a@b", account.Mail);
|
||||
Assert.AreEqual("112", account.Pwd);
|
||||
Assert.That(account.IsAgbAcknowledged, Is.False);
|
||||
Assert.AreEqual("3330", account.SessionCookie);
|
||||
Assert.AreEqual("Honkey,Tonkey", String.Join(",", account.Group));
|
||||
Assert.AreEqual(TINK.Model.User.Account.Permissions.None, account.DebugLevel);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstruct_InvalidGroup()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => new TINK.Model.User.Account.Account("a@b", "112", "3330", null, TINK.Model.User.Account.Permissions.None));
|
||||
Assert.Throws<ArgumentException>(() => new TINK.Model.User.Account.Account("a@b", "112", false, "3330", null, TINK.Model.User.Account.Permissions.None));
|
||||
Assert.Throws<ArgumentException>(() => new TINK.Model.User.Account.Account(null));
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ using TINK.Repository;
|
|||
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
using TestFramework.Model.User.Account;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestTINKLib
|
||||
{
|
||||
|
@ -18,11 +20,11 @@ namespace TestTINKLib
|
|||
[Test]
|
||||
public void TestConstruct_NotLoggedIn_NoUsername()
|
||||
{
|
||||
var l_oStoreMock = new StoreMock(); // Account without user name, password and cookie
|
||||
var storeMock = new StoreMock(); // Account without user name, password and cookie
|
||||
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
l_oStoreMock.Load().Result,
|
||||
storeMock,
|
||||
storeMock.Load().Result,
|
||||
"HwId1000000000000");
|
||||
|
||||
Assert.IsFalse(l_oUser.IsLoggedIn);
|
||||
|
@ -34,23 +36,23 @@ namespace TestTINKLib
|
|||
[Test]
|
||||
public void TestConstruct_NotLoggedIn_NoCookie()
|
||||
{
|
||||
var l_oStoreMock = new StoreMock(new Account("John", "123", null, new List<string>())); // Account without session cookie.
|
||||
var storeMock = new StoreMock(new Account("John", "123", true, null, new List<string>())); // Account without session cookie.
|
||||
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
l_oStoreMock.Load().Result,
|
||||
var user = new User(
|
||||
storeMock,
|
||||
storeMock.Load().Result,
|
||||
"123456789");
|
||||
|
||||
Assert.IsFalse(l_oUser.IsLoggedIn);
|
||||
Assert.AreEqual("John", l_oUser.Mail);
|
||||
Assert.AreEqual("123", l_oUser.Password);
|
||||
Assert.IsNull(l_oUser.SessionCookie);
|
||||
Assert.IsFalse(user.IsLoggedIn);
|
||||
Assert.AreEqual("John", user.Mail);
|
||||
Assert.AreEqual("123", user.Password);
|
||||
Assert.IsNull(user.SessionCookie);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstruct_LoggedIn()
|
||||
{
|
||||
var l_oStoreMock = new StoreMock(new Account("John", "123", "9512", new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("John", "123", false, "9512", new List<string> { "TINK" }));
|
||||
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
|
@ -66,9 +68,10 @@ namespace TestTINKLib
|
|||
|
||||
/// <summary>Test logging in. </summary>
|
||||
[Test]
|
||||
public void TestSetCredentials()
|
||||
public async Task TestSetCredentials()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory(SampleSets.Set2, 1));
|
||||
|
@ -88,7 +91,7 @@ namespace TestTINKLib
|
|||
LoginSessionCopriInfo.JavaministerHardwareNr1.Pwd,
|
||||
l_oUser.DeviceId).Result;
|
||||
|
||||
l_oUser.Login(l_oAccount);
|
||||
await l_oUser.Login(l_oAccount);
|
||||
Assert.IsTrue(l_oUser.IsLoggedIn);
|
||||
|
||||
Assert.AreEqual(LoginSessionCopriInfo.JavaministerHardwareNr1.Mail, l_oUser.Mail);
|
||||
|
|
|
@ -43,7 +43,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -81,8 +82,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "UnknownCookie", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "UnknownCookie", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -121,8 +123,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -160,8 +163,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -199,7 +203,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
|
||||
uri,
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
|
@ -212,6 +216,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
|
|
@ -24,7 +24,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
public void TestCreate()
|
||||
{
|
||||
// Verify handler for disposable bike.
|
||||
var bike = new BikeInfoMutable(new BikeInfo("22", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "12"));
|
||||
var bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "12"),
|
||||
"My Station Name");
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, bike.State.Value);
|
||||
Assert.AreEqual(LockingState.Disconnected, bike.LockInfo.State);
|
||||
Assert.AreEqual(
|
||||
|
@ -42,7 +44,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for requested bike with state unknown.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id */, new Guid(), /*K User*/ null, /*K Admin*/ null, /*K Seed*/ null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id */, new Guid(), /*K User*/ null, /*K Admin*/ null, /*K Seed*/ null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
Assert.AreEqual(
|
||||
typeof(ReservedDisconnected),
|
||||
RequestHandlerFactory.Create(
|
||||
|
@ -58,7 +62,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for requested bike with state closed.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
bike.LockInfo.State = LockingState.Closed;
|
||||
Assert.AreEqual(
|
||||
typeof(ReservedClosed),
|
||||
|
@ -75,7 +81,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for requested bike with state open.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
bike.LockInfo.State = LockingState.Open;
|
||||
Assert.AreEqual(
|
||||
typeof(ReservedOpen),
|
||||
|
@ -92,7 +100,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for booked bike with state closed.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
bike.LockInfo.State = LockingState.Closed;
|
||||
Assert.AreEqual(
|
||||
typeof(BookedClosed),
|
||||
|
@ -109,7 +119,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for booked bike with state open.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
bike.LockInfo.State = LockingState.Open;
|
||||
Assert.AreEqual(
|
||||
typeof(BookedOpen),
|
||||
|
@ -126,7 +138,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for booked bike with state unknown.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
|
||||
Assert.AreEqual(
|
||||
typeof(BookedDisconnected),
|
||||
|
|
|
@ -43,7 +43,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -120,7 +121,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -194,7 +196,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -263,7 +266,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -332,7 +336,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -416,6 +421,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -500,6 +506,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
|
|
@ -24,16 +24,17 @@ namespace UITest.Fixtures.ViewModel
|
|||
private class BikeInfoMutable : TINK.Model.Bike.BC.BikeInfoMutable
|
||||
{
|
||||
public BikeInfoMutable(
|
||||
string p_iId,
|
||||
bool p_bIsDemo = false,
|
||||
IEnumerable<string> p_oGroup = null,
|
||||
WheelType? p_eWheelType = null,
|
||||
TypeOfBike? p_eTypeOfBike = null,
|
||||
string id,
|
||||
bool isDemo = false,
|
||||
IEnumerable<string> group = null,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string p_strCurrentStationName = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
Func<DateTime> p_oDateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(p_iId, p_bIsDemo, p_oGroup, p_eWheelType, p_eTypeOfBike, description, p_strCurrentStationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +159,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
"ragu@gnu-systems.de",
|
||||
"4asdfA");
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("john@long", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("john@long", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
|
||||
var l_oViewModel = new TINK.ViewModel.Bikes.Bike.BC.BikeViewModel(
|
||||
null,
|
||||
|
@ -196,7 +197,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
"ragu@gnu-systems.de",
|
||||
"4asdfA");
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("john@long", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("john@long", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
|
||||
var l_oViewModel = new TINK.ViewModel.Bikes.Bike.BC.BikeViewModel(
|
||||
null,
|
||||
|
|
|
@ -17,16 +17,17 @@ namespace UITest.Fixtures.ViewModel
|
|||
private class BikeInfoMutable : TINK.Model.Bike.BC.BikeInfoMutable
|
||||
{
|
||||
public BikeInfoMutable(
|
||||
string p_iId,
|
||||
bool p_bIsDemo = false,
|
||||
IEnumerable<string> p_oGroup = null,
|
||||
WheelType? p_eWheelType = null,
|
||||
TypeOfBike? p_eTypeOfBike = null,
|
||||
string id,
|
||||
bool pisDemo = false,
|
||||
IEnumerable<string> group = null,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string p_strCurrentStationName = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
Func<DateTime> p_oDateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(p_iId, p_bIsDemo, p_oGroup, p_eWheelType, p_eTypeOfBike, description, p_strCurrentStationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
|
||||
IStateInfo stateInfo = null) : base(id, pisDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +44,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
TypeOfBike.Cargo,
|
||||
"Test description",
|
||||
"3",
|
||||
"Radstation",
|
||||
null,
|
||||
() => new DateTime(1980, 1, 1)); // Now time stamp
|
||||
|
||||
|
@ -52,7 +54,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
new DateTime(1980, 1, 1), // Date when bike was booked.
|
||||
"ragu@gnu-systems.de"); // Owner from Copri.
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
l_oStoreMock.Load().Result,
|
||||
|
@ -82,6 +84,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
TypeOfBike.Cargo,
|
||||
"Test description",
|
||||
"3",
|
||||
"Radstation",
|
||||
null,
|
||||
() => (new DateTime(1980, 1, 1)).Add(new TimeSpan(0, 8, 0)));
|
||||
|
||||
|
@ -92,7 +95,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
"ragu@gnu-systems.de", // Owner from Copri.
|
||||
"4asdfA"); // Reservation code from Copri
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock, // Mocks account store functionality.
|
||||
l_oStoreMock.Load().Result,
|
||||
|
@ -124,7 +127,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
|
||||
var l_oCopriServer = new CopriCallsMemory(SampleSets.Set1, 1);
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
l_oStoreMock.Load().Result,
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
null, // viewUpdateManager
|
||||
NSubstitute.Substitute.For<ISmartDevice>(),
|
||||
null, // viewService
|
||||
new TINK.Model.Bike.BC.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42")),
|
||||
new TINK.Model.Bike.BC.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42"), "My Station Name"),
|
||||
MockRepository.GenerateStub<IUser>(), // user
|
||||
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
|
||||
MockRepository.GenerateStub<IBikesViewModel>()).GetType()); // stateInfoProvider
|
||||
|
@ -44,7 +44,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
null, // viewUpdateManager
|
||||
NSubstitute.Substitute.For<ISmartDevice>(),
|
||||
null, // viewService
|
||||
new TINK.Model.Bike.BluetoothLock.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42")),
|
||||
new TINK.Model.Bike.BluetoothLock.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42"), "My Station Name"),
|
||||
MockRepository.GenerateStub<IUser>(), // user
|
||||
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
|
||||
MockRepository.GenerateStub<IBikesViewModel>()).GetType()); // stateInfoProvider
|
||||
|
|
|
@ -70,8 +70,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" } )),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" } )),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -93,6 +94,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -117,8 +119,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Close lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Open lock & continue renting", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -161,8 +163,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -184,6 +187,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -213,8 +217,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Search lock", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -260,8 +264,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -283,6 +288,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -311,8 +317,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Search lock", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -354,8 +360,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -377,6 +384,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -403,8 +411,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Search lock", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -446,8 +454,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -469,6 +478,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -499,8 +509,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Search lock", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -532,8 +542,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "Invalid_SessionCookie", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "Invalid_SessionCookie", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -555,6 +566,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -593,8 +605,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -616,6 +629,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -657,7 +671,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
|
||||
uri,
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
|
@ -670,6 +684,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -691,6 +706,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -735,7 +751,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
|
||||
uri,
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
|
@ -748,6 +764,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -769,6 +786,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
|
|
@ -27,7 +27,8 @@ namespace TestTINKLib.Fixtures.UseCases.ConnectedOffline
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
|||
public void TestBikesAtStation_AccountStoreMock_NoUser_CopriMock_Set2()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory(SampleSets.Set2, 1));
|
||||
|
@ -39,7 +40,8 @@ namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
"myMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -50,25 +52,25 @@ namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
|||
currentVersion: new Version(3, 2, 0, 115),
|
||||
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
|
||||
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Station.Station("5", new List<string>(), null);
|
||||
Assert.AreEqual(3, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual("25", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("25").Id);
|
||||
Assert.AreEqual("11", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("11").Id);
|
||||
Assert.AreEqual("2", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("2").Id);
|
||||
Assert.AreEqual(3, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual("25", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("25").Id);
|
||||
Assert.AreEqual("11", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("11").Id);
|
||||
Assert.AreEqual("2", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("2").Id);
|
||||
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Station.Station("10", new List<string>(), null);
|
||||
|
||||
Assert.AreEqual(
|
||||
1,
|
||||
TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
|
||||
Assert.AreEqual("18", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("18").Id);
|
||||
Assert.AreEqual("18", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("18").Id);
|
||||
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Station.Station("91345", new List<string>(), null);
|
||||
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Bike;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.User;
|
||||
|
||||
namespace TestTINKLib.Fixtures.UseCases
|
||||
|
@ -14,13 +16,14 @@ namespace TestTINKLib.Fixtures.UseCases
|
|||
public static async Task<BikeCollectionMutable> GetBikesAtStation(
|
||||
User user,
|
||||
TINK.Model.Connector.IConnector connector,
|
||||
string selectedStation)
|
||||
IEnumerable<IStation> stations,
|
||||
string selectedStationId)
|
||||
{
|
||||
var l_oBikesAtStation = new BikeCollectionMutable();
|
||||
|
||||
var l_oBikesAvailable = (await connector.Query.GetBikesAsync()).Response;
|
||||
|
||||
l_oBikesAtStation.Update(l_oBikesAvailable.GetAtStation(selectedStation));
|
||||
l_oBikesAtStation.Update(l_oBikesAvailable.GetAtStation(selectedStationId), stations);
|
||||
|
||||
return l_oBikesAtStation;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
<Compile Include="Fixtures\ObjectTests\Services\TestServicesContainerMutable.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\Settings\BluetoothLock\TestLockIt.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\Account\TestAccountPageViewModel.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\BC\TestBikeInfo.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\BluetoothLock\TestBikeInfo.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\BluetoothLock\TestLockInfo.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\BluetoothLock\TestLockInfoHelper.cs" />
|
||||
|
@ -107,7 +106,6 @@
|
|||
<Compile Include="Fixtures\ObjectTests\ViewModel\Settings\TestFilterCollectionMutable.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikeAtStationInUseStateInfoProvider.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikeAtStationViewModel.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikesAtStationPageViewModel.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikeViewModel.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikeViewModelFactory.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestMyBikeInUseStateInfoProvider.cs" />
|
||||
|
@ -116,7 +114,6 @@
|
|||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestViewModelHelper.cs" />
|
||||
<Compile Include="Fixtures\UseCases\ConnectedOffline\TestTinkApp.cs" />
|
||||
<Compile Include="Fixtures\UseCases\TestHelper.cs" />
|
||||
<Compile Include="LoginSessionCopriInfo.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\TestBikeSerializeJSON.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\TestBikeCollectionSerializeJSON.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\TestStateBookedInfoSerializeJSON.cs" />
|
||||
|
|
Loading…
Add table
Reference in a new issue