mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-22 04:46:30 +02:00
Merge branch 'master' into US-166/location-permission
# Conflicts: # TINK/TINK/View/Map/MapPage.xaml.cs # TINKLib/ViewModel/Map/MapPageViewModel.cs # TestFramework/Services/Permissions/PermissionsMock.cs # TestTINKLib/TestTINKLib.csproj
This commit is contained in:
commit
30c4e4879b
80 changed files with 2737 additions and 481 deletions
|
@ -31,10 +31,10 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Filter
|
|||
[Test]
|
||||
public void TestDoFilter()
|
||||
{
|
||||
var filter = new IntersectGroupFilter(new List<string> { "Tonk", "Honk" });
|
||||
var filter = new IntersectGroupFilter(new List<string> { "FR_001", "FR_009" });
|
||||
|
||||
Assert.AreEqual(1, filter.DoFilter(new List<string> { "Tonk", "Klonk" }).Count());
|
||||
Assert.AreEqual("Tonk", filter.DoFilter(new List<string> { "Tonk", "Klonk" }).ToArray()[0]);
|
||||
Assert.AreEqual(1, filter.DoFilter(new List<string> { "FR_001", "FR_007" }).Count());
|
||||
Assert.AreEqual("FR_001", filter.DoFilter(new List<string> { "FR_001", "FR_007" }).ToArray()[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using TINK.Model.Connector;
|
||||
using System.Linq;
|
||||
using TINK.Repository;
|
||||
using TestFramework.Repository;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
||||
{
|
||||
|
@ -15,34 +16,34 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
[Test]
|
||||
public void TestGetStationsAll()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
var connector = new ConnectorCache(
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory(CopriCallsMemory.SampleSets.Set2, 1));
|
||||
new CopriCallsMemory001());
|
||||
|
||||
var l_oFilter = new FilteredConnector(new List<string> { "TINK", "Konrad" }, l_oConnector);
|
||||
var l_oStations = l_oFilter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(9, l_oStations.StationsAll.Count());
|
||||
var filter = new FilteredConnector(new List<string> { FilterHelper.FILTERTINKGENERAL, FilterHelper.FILTERKONRAD }, connector);
|
||||
var stations = filter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(41, stations.StationsAll.Count()); // Count of stations was 9 before switching to data provider CopriCallsMemory(CopriCallsMemory.SampleSets.Set2, 1)
|
||||
|
||||
l_oFilter = new FilteredConnector(new List<string> { "TINK" }, l_oConnector);
|
||||
l_oStations = l_oFilter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(8, l_oStations.StationsAll.Count());
|
||||
filter = new FilteredConnector(new List<string> { FilterHelper.FILTERTINKGENERAL }, connector);
|
||||
stations = filter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(21, stations.StationsAll.Count());
|
||||
|
||||
l_oFilter = new FilteredConnector(new List<string> { "Konrad" }, l_oConnector);
|
||||
l_oStations = l_oFilter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(2, l_oStations.StationsAll.Count());
|
||||
filter = new FilteredConnector(new List<string> { FilterHelper.FILTERKONRAD }, connector);
|
||||
stations = filter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(27, stations.StationsAll.Count());
|
||||
|
||||
l_oFilter = new FilteredConnector(new List<string> { "AGroupNamedNonsensDoesNotExist" }, l_oConnector);
|
||||
l_oStations = l_oFilter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(0, l_oStations.StationsAll.Count());
|
||||
filter = new FilteredConnector(new List<string> { "AGroupNamedNonsensDoesNotExist" }, connector);
|
||||
stations = filter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(0, stations.StationsAll.Count());
|
||||
|
||||
l_oFilter = new FilteredConnector(new List<string>(), l_oConnector);
|
||||
l_oStations = l_oFilter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(9, l_oStations.StationsAll.Count());
|
||||
filter = new FilteredConnector(new List<string>(), connector);
|
||||
stations = filter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(41, stations.StationsAll.Count());
|
||||
|
||||
l_oFilter = new FilteredConnector(null, l_oConnector);
|
||||
l_oStations = l_oFilter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(9, l_oStations.StationsAll.Count(), "Null means filter none.");
|
||||
filter = new FilteredConnector(null, connector);
|
||||
stations = filter.Query.GetBikesAndStationsAsync().Result.Response;
|
||||
Assert.AreEqual(41, stations.StationsAll.Count(), "Null means filter none.");
|
||||
}
|
||||
|
||||
/// <summary> Tests all stations. </summary>
|
||||
|
@ -52,19 +53,19 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oConnector = new ConnectorCache(
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory(CopriCallsMemory.SampleSets.Set2, 1));
|
||||
new CopriCallsMemory001());
|
||||
|
||||
var l_oFilter = new FilteredConnector(new List<string> { "TINK", "Konrad" }, l_oConnector);
|
||||
var l_oFilter = new FilteredConnector(new List<string> { FilterHelper.FILTERTINKGENERAL, FilterHelper.FILTERKONRAD }, l_oConnector);
|
||||
var l_oBikes = l_oFilter.Query.GetBikesAsync().Result.Response;
|
||||
Assert.AreEqual(12, l_oBikes.Count());
|
||||
Assert.AreEqual(8, l_oBikes.Count()); // Count of stations was 12 CopriCallsMemory(CopriCallsMemory.SampleSets.Set2, 1)
|
||||
|
||||
l_oFilter = new FilteredConnector(new List<string> { "TINK" }, l_oConnector);
|
||||
l_oFilter = new FilteredConnector(new List<string> { FilterHelper.FILTERTINKGENERAL }, l_oConnector);
|
||||
l_oBikes = l_oFilter.Query.GetBikesAsync().Result.Response;
|
||||
Assert.AreEqual(11, l_oBikes.Count());
|
||||
Assert.AreEqual(5, l_oBikes.Count()); // Was 11
|
||||
|
||||
l_oFilter = new FilteredConnector(new List<string> { "Konrad" }, l_oConnector);
|
||||
l_oFilter = new FilteredConnector(new List<string> { FilterHelper.FILTERKONRAD }, l_oConnector);
|
||||
l_oBikes = l_oFilter.Query.GetBikesAsync().Result.Response;
|
||||
Assert.AreEqual(1, l_oBikes.Count());
|
||||
Assert.AreEqual(3, l_oBikes.Count()); // Was 1
|
||||
|
||||
l_oFilter = new FilteredConnector(new List<string> { "AGroupNamedNonsensDoesNotExist" }, l_oConnector);
|
||||
l_oBikes = l_oFilter.Query.GetBikesAsync().Result.Response;
|
||||
|
@ -72,11 +73,11 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
|
||||
l_oFilter = new FilteredConnector(new List<string>(), l_oConnector);
|
||||
l_oBikes = l_oFilter.Query.GetBikesAsync().Result.Response;
|
||||
Assert.AreEqual(12, l_oBikes.Count(), "List with zero element means filter all.");
|
||||
Assert.AreEqual(8, l_oBikes.Count(), "List with zero element means filter all."); // Was 12
|
||||
|
||||
l_oFilter = new FilteredConnector(null, l_oConnector);
|
||||
l_oBikes = l_oFilter.Query.GetBikesAsync().Result.Response;
|
||||
Assert.AreEqual(12, l_oBikes.Count(), "Null means filter none.");
|
||||
Assert.AreEqual(8, l_oBikes.Count(), "Null means filter none.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -342,18 +342,21 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestGetAuthGroup()
|
||||
{
|
||||
var l_oResponse = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
// User group was of format [ ""TINK"", ""Konrad"" ] in early day...
|
||||
// Since COPRI 4.1 use group is no more used.
|
||||
// Groups are of format <OperatorId>_<BikeType> for this user group would be like below if it would be used.
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""response"" : ""authorization"",
|
||||
""authcookie"" : ""4da3044c8657a04ba60e2eaa753bc51a"",
|
||||
""user_group"" : [ ""TINK"", ""Konrad"" ],
|
||||
""user_group"" : [ ""KN_300102"", ""KN_300101"" ],
|
||||
""response_state"" : ""OK"",
|
||||
""apiserver"" : ""https://tinkwwp.copri-bike.de""
|
||||
}");
|
||||
|
||||
Assert.AreEqual(2, l_oResponse.GetGroup().ToList().Count);
|
||||
Assert.AreEqual(FilterHelper.FILTERTINKGENERAL, l_oResponse.GetGroup().ToList()[0]);
|
||||
Assert.AreEqual("Konrad", l_oResponse.GetGroup().ToList()[1]);
|
||||
Assert.AreEqual(2, response.GetGroup().ToList().Count);
|
||||
Assert.AreEqual($"KN_300102", response.GetGroup().ToList()[0]);
|
||||
Assert.AreEqual($"KN_300101", response.GetGroup().ToList()[1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.ViewModel.Map;
|
||||
|
||||
namespace UITest.Fixtures.ObjectTests.Map
|
||||
|
@ -19,23 +19,23 @@ namespace UITest.Fixtures.ObjectTests.Map
|
|||
[Test]
|
||||
public void TestCurrentFilter()
|
||||
{
|
||||
var l_oFilter = new TinkKonradToggleViewModel(new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }));
|
||||
var l_oFilter = new TinkKonradToggleViewModel(new GroupFilterMapPage(new Dictionary<string, FilterState> { { $"HOM_{FilterHelper.FILTERTINKGENERAL}", FilterState.On }, { "Konrad", FilterState.Off } }));
|
||||
|
||||
Assert.AreEqual("TINK", l_oFilter.CurrentFilter);
|
||||
Assert.AreEqual($"HOM_{FilterHelper.FILTERTINKGENERAL}", l_oFilter.CurrentFilter);
|
||||
|
||||
l_oFilter = new TinkKonradToggleViewModel(new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.Off }, { "Konrad", FilterState.On } }));
|
||||
l_oFilter = new TinkKonradToggleViewModel(new GroupFilterMapPage(new Dictionary<string, FilterState> { { $"HOM_{FilterHelper.FILTERTINKGENERAL}", FilterState.Off }, { $"HOM_{ FilterHelper.FILTERKONRAD}", FilterState.On } }));
|
||||
|
||||
Assert.AreEqual("Konrad", l_oFilter.CurrentFilter);
|
||||
Assert.AreEqual($"HOM_{ FilterHelper.FILTERKONRAD}", l_oFilter.CurrentFilter);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIsToggleVisible()
|
||||
{
|
||||
var l_oFilter = new TinkKonradToggleViewModel(new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On } }));
|
||||
var l_oFilter = new TinkKonradToggleViewModel(new GroupFilterMapPage(new Dictionary<string, FilterState> { { $"HOM_{FilterHelper.FILTERTINKGENERAL}", FilterState.On } }));
|
||||
|
||||
Assert.IsFalse(l_oFilter.IsToggleVisible);
|
||||
|
||||
l_oFilter = new TinkKonradToggleViewModel(new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.Off }, { "Konrad", FilterState.On } }));
|
||||
l_oFilter = new TinkKonradToggleViewModel(new GroupFilterMapPage(new Dictionary<string, FilterState> { { $"HOM_{FilterHelper.FILTERTINKGENERAL}", FilterState.Off }, { $"HOM_{ FilterHelper.FILTERKONRAD}", FilterState.On } }));
|
||||
|
||||
Assert.IsTrue(l_oFilter.IsToggleVisible);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.ViewModel.Settings;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Settings
|
||||
|
@ -12,12 +13,12 @@ namespace TestTINKLib.Fixtures.ObjectTests.Settings
|
|||
[Test]
|
||||
public void TestDoFilter()
|
||||
{
|
||||
var l_oFilter = new GroupFilterSettings(new Dictionary<string, FilterState> { { "Konrad", FilterState.Off }, { "TINK", FilterState.On }, { "FutureBikeType", FilterState.On} });
|
||||
var l_oFilter = new GroupFilterSettings(new Dictionary<string, FilterState> { { $"HOM_{FilterHelper.FILTERKONRAD}", FilterState.Off }, { $"HOM_{FilterHelper.FILTERTINKGENERAL}", FilterState.On }, { "HOM_117025", FilterState.On} });
|
||||
|
||||
var l_oResult = l_oFilter.DoFilter(new List<string> { "Konrad", "TINK" });
|
||||
var l_oResult = l_oFilter.DoFilter(new List<string> { $"HOM_{FilterHelper.FILTERKONRAD}", $"HOM_{FilterHelper.FILTERTINKGENERAL}" });
|
||||
|
||||
Assert.AreEqual(1, l_oResult.ToList().Count);
|
||||
Assert.AreEqual("TINK", l_oResult.ToList()[0]);
|
||||
Assert.AreEqual($"HOM_{FilterHelper.FILTERTINKGENERAL}", l_oResult.ToList()[0]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,12 @@
|
|||
using NUnit.Framework;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Services.CopriApi.ServerUris;
|
||||
using TINK.Settings;
|
||||
using TINK.ViewModel.Map;
|
||||
using TINK.ViewModel.Settings;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Settings
|
||||
{
|
||||
|
@ -17,9 +20,11 @@ namespace TestTINKLib.Fixtures.ObjectTests.Settings
|
|||
|
||||
Assert.AreEqual(LogEventLevel.Error, settings.MinimumLogEventLevel);
|
||||
|
||||
Assert.AreEqual(GroupFilterHelper.GetSettingsFilterDefaults, settings.GroupFilterSettings);
|
||||
// Was GroupFilterHelper.GetSettingsFilterDefaults when used in TINK- context.
|
||||
Assert.AreEqual(new GroupFilterSettings(), settings.GroupFilterSettings);
|
||||
|
||||
Assert.AreEqual(GroupFilterHelper.GetMapPageFilterDefaults, settings.GroupFilterMapPage);
|
||||
// Was GroupFilterHelper.GetMapPageFilterDefaults when used in TINK- context.
|
||||
Assert.AreEqual(new GroupFilterMapPage(), settings.GroupFilterMapPage);
|
||||
|
||||
Assert.AreEqual(new CopriServerUriList().ActiveUri, settings.ActiveUri);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using Rhino.Mocks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.User.Account;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.User.Account
|
||||
|
@ -17,16 +18,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.User.Account
|
|||
|
||||
l_oAccount.Stub((x) => x.Mail).Return("a@b");
|
||||
l_oAccount.Stub((x) => x.SessionCookie).Return(""); // User is not logged in
|
||||
l_oAccount.Stub((x) => x.Group).Return(new List<string> { "TINK", "FutureType" });
|
||||
l_oAccount.Stub((x) => x.Group).Return(new List<string> { $"HOM_{FilterHelper.FILTERTINKGENERAL}", "HOM_117025" });
|
||||
|
||||
var l_oSource = new List<string> { "TINK", "Konrad", "FutureType" };
|
||||
var l_oSource = new List<string> { $"HOM_{FilterHelper.FILTERTINKGENERAL}", $"HOM_{FilterHelper.FILTERKONRAD}", "HOM_117025" };
|
||||
|
||||
var l_oResult = l_oAccount.DoFilter(l_oSource);
|
||||
|
||||
Assert.AreEqual(3, l_oResult.ToList().Count);
|
||||
Assert.AreEqual("TINK", l_oResult.ToList()[0]);
|
||||
Assert.AreEqual("Konrad", l_oResult.ToList()[1]);
|
||||
Assert.AreEqual("FutureType", l_oResult.ToList()[2]);
|
||||
Assert.AreEqual($"HOM_{FilterHelper.FILTERTINKGENERAL}", l_oResult.ToList()[0]);
|
||||
Assert.AreEqual($"HOM_{FilterHelper.FILTERKONRAD}", l_oResult.ToList()[1]);
|
||||
Assert.AreEqual("HOM_117025", l_oResult.ToList()[2]);
|
||||
}
|
||||
/// <summary> </summary>
|
||||
[Test]
|
||||
|
@ -36,15 +37,15 @@ namespace TestTINKLib.Fixtures.ObjectTests.User.Account
|
|||
|
||||
l_oAccount.Stub((x) => x.Mail).Return("a@b");
|
||||
l_oAccount.Stub((x) => x.SessionCookie).Return("123");
|
||||
l_oAccount.Stub((x) => x.Group).Return(new List<string> { "TINK", "FutureType" });
|
||||
l_oAccount.Stub((x) => x.Group).Return(new List<string> { $"HOM_{FilterHelper.FILTERTINKGENERAL}", "HOM_117025" });
|
||||
|
||||
var l_oSource = new List<string> { "TINK", "Konrad", "FutureType" };
|
||||
var l_oSource = new List<string> { $"HOM_{FilterHelper.FILTERTINKGENERAL}", $"HOM_{FilterHelper.FILTERKONRAD}", "HOM_117025" };
|
||||
|
||||
var l_oResult = l_oAccount.DoFilter(l_oSource);
|
||||
|
||||
Assert.AreEqual(2, l_oResult.ToList().Count);
|
||||
Assert.AreEqual("TINK", l_oResult.ToList()[0]);
|
||||
Assert.AreEqual("FutureType", l_oResult.ToList()[1]);
|
||||
Assert.AreEqual($"HOM_{FilterHelper.FILTERTINKGENERAL}", l_oResult.ToList()[0]);
|
||||
Assert.AreEqual("HOM_117025", l_oResult.ToList()[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model.User;
|
||||
using TINK.Model.Connector;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
|
||||
using TINK.Model.User.Account;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Repository;
|
||||
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
using TestFramework.Model.User.Account;
|
||||
|
||||
namespace TestTINKLib
|
||||
{
|
||||
|
|
|
@ -4,9 +4,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TestTINKLib.Mocks.Connector;
|
||||
using TestTINKLib.Mocks.Device;
|
||||
using TestTINKLib.Mocks.Services;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository.Exception;
|
||||
|
@ -14,7 +11,6 @@ using TINK.View;
|
|||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository;
|
||||
|
||||
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
using TINK.ViewModel.Map;
|
||||
using TINK.ViewModel.Settings;
|
||||
|
@ -22,6 +18,13 @@ using TINK.ViewModel.Account;
|
|||
using TINK.Services;
|
||||
using TINK.Model.Services.Geolocation;
|
||||
using NSubstitute;
|
||||
using TestFramework.Model.Device;
|
||||
using TestFramework.Repository;
|
||||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Services.BluetoothLock;
|
||||
using TestFramework.Services.Permissions;
|
||||
using TestFramework.Services.CopriApi.Connector;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Account
|
||||
{
|
||||
|
@ -99,7 +102,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
|
||||
await settingsPageViewModel.OnAppearing();
|
||||
|
||||
Assert.AreEqual("Logged in as a@b at TINK.", settingsPageViewModel.LoggedInInfo);
|
||||
Assert.AreEqual("Logged in as a@b.", settingsPageViewModel.LoggedInInfo);
|
||||
Assert.IsFalse(settingsPageViewModel.IsBookingStateInfoVisible, "A user is logged but no bikes requested/ booked.");
|
||||
Assert.AreEqual(string.Empty, settingsPageViewModel.BookingStateInfo);
|
||||
}
|
||||
|
@ -116,8 +119,8 @@ 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", "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", "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -137,7 +140,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
|
||||
await settingsPageViewModel.OnAppearing();
|
||||
|
||||
Assert.AreEqual("Logged in as a@b at TINK.", settingsPageViewModel.LoggedInInfo);
|
||||
Assert.AreEqual("Logged in as a@b.", settingsPageViewModel.LoggedInInfo);
|
||||
Assert.IsTrue(settingsPageViewModel.IsBookingStateInfoVisible, "A user is logged but no bikes requested/ booked.");
|
||||
Assert.AreEqual("Aktuell 2 Fahrräder reserviert/ gebucht.", settingsPageViewModel.BookingStateInfo);
|
||||
}
|
||||
|
@ -154,8 +157,8 @@ 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", "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", "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -175,7 +178,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
|
||||
await settingsPageViewModel.OnAppearing();
|
||||
|
||||
Assert.AreEqual("Logged in as a@b at TINK.", settingsPageViewModel.LoggedInInfo);
|
||||
Assert.AreEqual("Logged in as a@b.", settingsPageViewModel.LoggedInInfo);
|
||||
Assert.IsTrue(settingsPageViewModel.IsBookingStateInfoVisible, "A user is logged but no bikes requested/ booked.");
|
||||
Assert.AreEqual("Aktuell 2 Fahrräder reserviert/ gebucht. Verbindungsstatus: Offline.", settingsPageViewModel.BookingStateInfo);
|
||||
}
|
||||
|
@ -192,7 +195,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", "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
|
||||
uri,
|
||||
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default",
|
||||
|
@ -203,7 +206,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
TinkApp.MerchantId,
|
||||
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default",
|
||||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory(SampleSets.Set2, sessionCookie: sessionCookie),
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
|
@ -224,7 +227,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
|
||||
await settingsPageViewModel.OnAppearing();
|
||||
|
||||
Assert.AreEqual("Logged in as a@b at TINK.", settingsPageViewModel.LoggedInInfo);
|
||||
Assert.AreEqual("Logged in as a@b.", settingsPageViewModel.LoggedInInfo); // CopriCallsCacheMemory(SampleSets.Set2,
|
||||
Assert.IsTrue(settingsPageViewModel.IsBookingStateInfoVisible, "A user is logged but no bikes requested/ booked.");
|
||||
Assert.AreEqual("Aktuell 2 Fahrräder reserviert/ gebucht. Verbindungsstatus: Offline.", settingsPageViewModel.BookingStateInfo);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
using Rhino.Mocks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TestTINKLib.Mocks.Services;
|
||||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Services.BluetoothLock;
|
||||
using TINK.Model.Bike.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.State;
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TestTINKLib.Mocks.Connector;
|
||||
using TestTINKLib.Mocks.Device;
|
||||
using TestTINKLib.Mocks.Services;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository;
|
||||
using TINK.View;
|
||||
using TINK.ViewModel.Map;
|
||||
using Xamarin.Forms;
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
using TINK.ViewModel.Settings;
|
||||
using TINK.Model.Services.Geolocation;
|
||||
using TINK.Services;
|
||||
using NSubstitute;
|
||||
using TINK.Services.Permissions;
|
||||
using TestFramework.Services.BluetoothLock;
|
||||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Model.Device;
|
||||
using TestFramework.Services.Permissions;
|
||||
using TestFramework.Repository;
|
||||
using TestFramework.Services.CopriApi.Connector;
|
||||
|
||||
namespace TestTINKLib.Fixtures.UseCases.Startup
|
||||
namespace TestShareeLib.UseCases.Startup
|
||||
{
|
||||
|
||||
[TestFixture]
|
||||
|
@ -34,15 +34,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
{
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
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(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -54,8 +54,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
|
||||
whatsNewShownInVersion: null); // Whats new page was never shown.
|
||||
|
||||
var viewService = MockRepository.GenerateStub<IViewService>();
|
||||
var navigationService = MockRepository.GenerateStub<INavigation>();
|
||||
var viewService = Substitute.For<IViewService>();
|
||||
var navigationService = Substitute.For<INavigation>();
|
||||
var locationPermission = Substitute.For<ILocationPermission>();
|
||||
|
||||
locationPermission.CheckStatusAsync().Returns(Status.Granted);
|
||||
|
@ -76,13 +76,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
Assert.IsNull(viewModel.Exception);
|
||||
|
||||
// Verify pins on map
|
||||
Assert.AreEqual(8, viewModel.Pins.Count);
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "4").Icon.Id.Contains("Green"),
|
||||
"Station 4 must be marked green because there is are bike.");
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "31").Icon.Id.Contains("Red"),
|
||||
"Station 31 must be marked red because there is no bike.");
|
||||
Assert.AreEqual(21, viewModel.Pins.Count); // Were 8 pins when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag,
|
||||
Is.EqualTo("FR105"),
|
||||
"Station FR105 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag,
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike."); // Was station id 31
|
||||
|
||||
// Verify buttons
|
||||
Assert.IsTrue(viewModel.IsToggleVisible, "TINK and Konrad are activated in settings.");
|
||||
|
@ -108,15 +110,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
{
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.Off }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.Off }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
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(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -128,8 +130,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
|
||||
whatsNewShownInVersion: null); // Whats new page was never shown.
|
||||
|
||||
var viewService = MockRepository.GenerateStub<IViewService>();
|
||||
var navigationService = MockRepository.GenerateStub<INavigation>();
|
||||
var viewService = Substitute.For<IViewService>();
|
||||
var navigationService = Substitute.For<INavigation>();
|
||||
var locationPermission = Substitute.For<ILocationPermission>();
|
||||
|
||||
locationPermission.CheckStatusAsync().Returns(Status.Granted);
|
||||
|
@ -150,13 +152,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
Assert.IsNull(viewModel.Exception);
|
||||
|
||||
// Verify pins on map
|
||||
Assert.AreEqual(2, viewModel.Pins.Count);
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "31").Icon.Id.Contains("Green"),
|
||||
"Station 5 must be marked green because there is are bike.");
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "14").Icon.Id.Contains("Red"),
|
||||
"Station 14 must be marked red because there is no bike.");
|
||||
Assert.AreEqual(27, viewModel.Pins.Count); // Were 2 pins when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag, // Was station 5
|
||||
Is.EqualTo("FR101"),
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was station 14
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
// Verify buttons
|
||||
Assert.IsTrue(viewModel.IsToggleVisible, "TINK and Konrad are activated in settings.");
|
||||
|
@ -174,22 +178,20 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Test]
|
||||
public async Task TestConstruct_KonradOnly()
|
||||
{
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "Konrad", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.Off }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.Off }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
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(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -199,8 +201,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
currentVersion: new Version(3, 2, 0, 115), // Current app version
|
||||
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
|
||||
|
||||
var viewService = MockRepository.GenerateStub<IViewService>();
|
||||
var navigationService = MockRepository.GenerateStub<INavigation>();
|
||||
var viewService = Substitute.For<IViewService>();
|
||||
var navigationService = Substitute.For<INavigation>();
|
||||
var locationPermission = Substitute.For<ILocationPermission>();
|
||||
|
||||
locationPermission.CheckStatusAsync().Returns(Status.Granted);
|
||||
|
@ -208,8 +210,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
var viewModel = new MapPageViewModel(
|
||||
tinkApp,
|
||||
locationPermission,
|
||||
NSubstitute.Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
NSubstitute.Substitute.For<IGeolocation>(),
|
||||
Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
Substitute.For<IGeolocation>(),
|
||||
(mapspan) => { },
|
||||
viewService,
|
||||
navigationService);
|
||||
|
@ -221,13 +223,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
Assert.IsNull(viewModel.Exception);
|
||||
|
||||
// Verify pins on map
|
||||
Assert.AreEqual(2, viewModel.Pins.Count);
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "31").Icon.Id.Contains("Green"),
|
||||
"Station 5 must be marked green because there is are bike.");
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "14").Icon.Id.Contains("Red"),
|
||||
"Station 14 must be marked red because there is no bike.");
|
||||
Assert.AreEqual(27, viewModel.Pins.Count); // Were 2 when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag, // Was station id 31
|
||||
Is.EqualTo("FR101"),
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was 14
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
// Verify buttons
|
||||
Assert.IsFalse(viewModel.IsToggleVisible, "TINK and Konrad is deactivated from settings.");
|
||||
|
@ -247,15 +251,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
{
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
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(sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -265,8 +269,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
currentVersion: new Version(3, 2, 0, 115), // Current app version
|
||||
lastVersion: new Version(3, 0, 173));
|
||||
|
||||
var viewService = MockRepository.GenerateStub<IViewService>();
|
||||
var navigationService = MockRepository.GenerateStub<INavigation>();
|
||||
var viewService = Substitute.For<IViewService>();
|
||||
var navigationService = Substitute.For<INavigation>();
|
||||
var locationPermission = Substitute.For<ILocationPermission>();
|
||||
|
||||
locationPermission.CheckStatusAsync().Returns(Status.Granted);
|
||||
|
@ -274,8 +278,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
var viewModel = new MapPageViewModel(
|
||||
tinkApp,
|
||||
locationPermission,
|
||||
NSubstitute.Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
NSubstitute.Substitute.For<IGeolocation>(),
|
||||
Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
Substitute.For<IGeolocation>(),
|
||||
(mapspan) => { },
|
||||
viewService,
|
||||
navigationService);
|
||||
|
@ -287,13 +291,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
Assert.IsNull(viewModel.Exception);
|
||||
|
||||
// Verify pins on map
|
||||
Assert.AreEqual(8, viewModel.Pins.Count);
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "4").Icon.Id.Contains("Green"),
|
||||
"Station 4 must be marked green because there is are bike.");
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "31").Icon.Id.Contains("Red"),
|
||||
"Station 31 must be marked red because there is no bike.");
|
||||
Assert.AreEqual(21, viewModel.Pins.Count); // Were 8 pin when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag,
|
||||
Is.EqualTo("FR103"), // Was station id 4
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was 31
|
||||
Is.EqualTo("KN12"), // Was station id 31
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
// Verify buttons
|
||||
Assert.IsFalse(viewModel.IsToggleVisible, "TINK and Konrad is deactivated from settings.");
|
||||
|
@ -313,15 +319,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
{
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
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(sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -331,8 +337,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
currentVersion: new Version(3, 2, 0, 115), // Current app version
|
||||
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
|
||||
|
||||
var viewService = MockRepository.GenerateStub<IViewService>();
|
||||
var navigationService = MockRepository.GenerateStub<INavigation>();
|
||||
var viewService = Substitute.For<IViewService>();
|
||||
var navigationService = Substitute.For<INavigation>();
|
||||
var locationPermission = Substitute.For<ILocationPermission>();
|
||||
|
||||
locationPermission.CheckStatusAsync().Returns(Status.Granted);
|
||||
|
@ -340,8 +346,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
var viewModel = new MapPageViewModel(
|
||||
tinkApp,
|
||||
locationPermission,
|
||||
NSubstitute.Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
NSubstitute.Substitute.For<IGeolocation>(),
|
||||
Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
Substitute.For<IGeolocation>(),
|
||||
(mapspan) => { },
|
||||
viewService,
|
||||
navigationService);
|
||||
|
@ -353,13 +359,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
Assert.IsNull(viewModel.Exception);
|
||||
|
||||
// Verify pins on map
|
||||
Assert.AreEqual(8, viewModel.Pins.Count);
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "4").Icon.Id.Contains("Green"),
|
||||
"Station 4 must be marked green because there is are bike.");
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "31").Icon.Id.Contains("Red"),
|
||||
"Station 31 must be marked red because there is no bike.");
|
||||
Assert.AreEqual(21, viewModel.Pins.Count); // Were 8 pins when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag, // Was station id 4
|
||||
Is.EqualTo("FR103"),
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was 31
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
// Verify buttons
|
||||
Assert.IsTrue(viewModel.IsToggleVisible, "TINK and Konrad are activated in settings.");
|
||||
|
@ -381,8 +389,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
{
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -400,7 +408,7 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
TinkApp.MerchantId,
|
||||
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default",
|
||||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
|
@ -411,8 +419,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
currentVersion: new Version(3, 2, 0, 115), // Current app version
|
||||
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
|
||||
|
||||
var viewService = MockRepository.GenerateStub<IViewService>();
|
||||
var navigationService = MockRepository.GenerateStub<INavigation>();
|
||||
var viewService = Substitute.For<IViewService>();
|
||||
var navigationService = Substitute.For<INavigation>();
|
||||
var locationPermission = Substitute.For<ILocationPermission>();
|
||||
|
||||
locationPermission.CheckStatusAsync().Returns(Status.Granted);
|
||||
|
@ -420,8 +428,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
var viewModel = new MapPageViewModel(
|
||||
tinkApp,
|
||||
locationPermission,
|
||||
NSubstitute.Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
NSubstitute.Substitute.For<IGeolocation>(),
|
||||
Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
Substitute.For<IGeolocation>(),
|
||||
(mapspan) => { },
|
||||
viewService,
|
||||
navigationService);
|
||||
|
@ -435,13 +443,15 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
viewModel.Exception.Message);
|
||||
|
||||
// Verify pins on map
|
||||
Assert.AreEqual(8, viewModel.Pins.Count);
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "4").Icon.Id.Contains("Green"),
|
||||
"Station 4 must be marked green because there is are bike.");
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "31").Icon.Id.Contains("Red"),
|
||||
"Station 31 must be marked red because there is no bike.");
|
||||
Assert.AreEqual(21, viewModel.Pins.Count);
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag, // Was station id 4
|
||||
Is.EqualTo("FR103"),
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was 31
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
// Verify buttons
|
||||
Assert.IsTrue(viewModel.IsToggleVisible, "TINK and Konrad are activated in settings.");
|
||||
|
@ -457,14 +467,13 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public async Task TestConstruct_GeneralPurposeCommunicationError()
|
||||
{
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -482,7 +491,7 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
TinkApp.MerchantId,
|
||||
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default",
|
||||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
|
@ -494,8 +503,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
|
||||
|
||||
|
||||
var viewService = MockRepository.GenerateStub<IViewService>();
|
||||
var navigationService = MockRepository.GenerateStub<INavigation>();
|
||||
var viewService = Substitute.For<IViewService>();
|
||||
var navigationService = Substitute.For<INavigation>();
|
||||
var locationPermission = Substitute.For<ILocationPermission>();
|
||||
|
||||
locationPermission.CheckStatusAsync().Returns(Status.Granted);
|
||||
|
@ -503,8 +512,8 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
var viewModel = new MapPageViewModel(
|
||||
tinkApp,
|
||||
locationPermission,
|
||||
NSubstitute.Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
NSubstitute.Substitute.For<IGeolocation>(),
|
||||
Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
Substitute.For<IGeolocation>(),
|
||||
(mapspan) => { },
|
||||
viewService,
|
||||
navigationService);
|
||||
|
@ -518,12 +527,14 @@ namespace TestTINKLib.Fixtures.UseCases.Startup
|
|||
viewModel.Exception.Message);
|
||||
|
||||
// Verify pins on map
|
||||
Assert.AreEqual(8, viewModel.Pins.Count);
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "4").Icon.Id.Contains("Green"),
|
||||
"Station 4 must be marked green because there is are bike.");
|
||||
Assert.IsTrue(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Tag.ToString() == "31").Icon.Id.Contains("Red"),
|
||||
Assert.AreEqual(21, viewModel.Pins.Count);
|
||||
Assert.That(
|
||||
viewModel.Pins.Where(pin => pin.Icon.Id.Contains("Open_Green")).Select(pin => pin.Tag.ToString()),
|
||||
Does.Contain("FR103"), // Was station id 4
|
||||
"Station FR103 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.Where(pin => pin.Icon.Id.Contains("Open_Red")).Select(pin => pin.Tag.ToString()),
|
||||
Does.Contain("KN12"), // Was station id 31
|
||||
"Station 31 must be marked red because there is no bike.");
|
||||
|
||||
// Verify buttons
|
||||
|
|
|
@ -4,7 +4,6 @@ using TINK.Model.Bike;
|
|||
using TINK.Model.User;
|
||||
using TINK.Model.User.Account;
|
||||
using TINK.ViewModel;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
|
||||
using Xamarin.Forms;
|
||||
using TINK.Model.State;
|
||||
|
@ -14,6 +13,7 @@ using System.Collections.Generic;
|
|||
using BikeInfoMutable = TINK.Model.Bike.BC.BikeInfoMutable;
|
||||
using TINK.ViewModel.Bikes;
|
||||
using TINK.Model.Device;
|
||||
using TestFramework.Model.User.Account;
|
||||
|
||||
namespace UITest.Fixtures.ViewModel
|
||||
{
|
||||
|
|
|
@ -3,13 +3,12 @@ using System;
|
|||
using TINK.Model.Bike;
|
||||
using TINK.Model.User;
|
||||
using TINK.Model.User.Account;
|
||||
using TINK.ViewModel;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
using TINK.Model.State;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Repository;
|
||||
using TINK.ViewModel.Bikes.Bike;
|
||||
using TestFramework.Model.User.Account;
|
||||
|
||||
namespace UITest.Fixtures.ViewModel
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System;
|
||||
using TestTINKLib.Mocks.Services;
|
||||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Services.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.User;
|
||||
using TINK.ViewModel;
|
||||
|
|
|
@ -3,10 +3,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TestTINKLib.Mocks.Connector;
|
||||
using TestTINKLib.Mocks.Device;
|
||||
using TestTINKLib.Mocks.Services;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository.Exception;
|
||||
|
@ -28,6 +24,12 @@ 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;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
||||
{
|
||||
|
@ -46,15 +48,15 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, 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 CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
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)),
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -71,7 +73,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
permissions,
|
||||
bluetooth,
|
||||
Device.Android,
|
||||
new TINK.Model.Station.Station("103", new List<string>(), null), // Station 103
|
||||
new TINK.Model.Station.Station("FR103", new List<string>(), null), // Was station id 103 before switching from data provider CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, ...)
|
||||
() => tinkApp.GetIsConnected(),
|
||||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
|
@ -91,13 +93,13 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Assert.IsTrue(bikesAtStation.IsIdle);
|
||||
Assert.IsTrue(bikesAtStation.IsBikesListVisible, "If there are any bikes, list must be visible.");
|
||||
|
||||
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;
|
||||
var bikeFR9999 = bikesAtStation.FirstOrDefault(x => x.Id == "FR9999") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel; // Was id 1315
|
||||
var bikeFR9998 = bikesAtStation.FirstOrDefault(x => x.Id == "FR9998") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel; // Was id 1543
|
||||
|
||||
Assert.AreEqual("Available.", bike1315.StateText);
|
||||
Assert.AreEqual("Available.", bike1543.StateText);
|
||||
Assert.AreEqual("NotLoggedIn", bike1315.LockitButtonText);
|
||||
Assert.AreEqual("NotLoggedIn", bike1543.LockitButtonText);
|
||||
Assert.AreEqual("Available.", bikeFR9999.StateText);
|
||||
Assert.AreEqual("Available.", bikeFR9998.StateText);
|
||||
Assert.AreEqual("NotLoggedIn", bikeFR9999.LockitButtonText);
|
||||
Assert.AreEqual("NotLoggedIn", bikeFR9998.LockitButtonText);
|
||||
|
||||
// Login hint/ no bikes frame
|
||||
Assert.IsTrue(bikesAtStation.IsLoginRequiredHintVisible);
|
||||
|
@ -117,8 +119,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -193,8 +195,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -293,8 +295,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -399,8 +401,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -502,8 +504,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -603,8 +605,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -696,15 +698,15 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.Off }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.Off }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000),true),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
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(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -721,7 +723,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
permissions,
|
||||
bluetooth,
|
||||
Device.iOS,
|
||||
new TINK.Model.Station.Station("31", new List<string>(), null),
|
||||
new TINK.Model.Station.Station("FR101", new List<string>(), null), // Was 31 before switching CopriCallsMemory(SampleSets.Set2, 1, ...)
|
||||
() => tinkApp.GetIsConnected(),
|
||||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
|
@ -737,11 +739,13 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Assert.IsTrue(new List<string> { "Updating...", string.Empty }.Contains(bikesAtStation.StatusInfoText));
|
||||
|
||||
// Verify list of bikes
|
||||
Assert.AreEqual(1, bikesAtStation.Count);
|
||||
Assert.AreEqual(3, bikesAtStation.Count); // Was 1 before switch.
|
||||
Assert.IsTrue(bikesAtStation.IsIdle);
|
||||
Assert.IsTrue(bikesAtStation.IsBikesListVisible, "If there are any bikes, list must be visible.");
|
||||
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "52").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR1003").StateText); // Was 52 before switch.
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR1002").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR1001").StateText);
|
||||
|
||||
// Login hint/ no bikes frame
|
||||
Assert.IsTrue(bikesAtStation.IsLoginRequiredHintVisible);
|
||||
|
@ -766,8 +770,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.Off }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.Off }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -833,19 +837,19 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, 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: locksService.GetType().FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account(
|
||||
LoginSessionCopriInfo.JavaministerHardwareNr1.Mail,
|
||||
LoginSessionCopriInfo.JavaministerHardwareNr1.Mail,
|
||||
LoginSessionCopriInfo.JavaministerHardwareNr1.Pwd,
|
||||
"4da3044c8657a04ba60e2eaa753bc51a",
|
||||
new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"6103_112e96b36ba33de245943c5ffaf369cd_", // Was 4da3044c8657a04ba60e2eaa753bc51a before switching from data provider CopriCallsMemory(SampleSets.Set2, 1, ...)
|
||||
new List<string> { FilterHelper.FILTERTINKGENERAL })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -862,7 +866,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
permissions,
|
||||
bluetooth,
|
||||
Device.iOS,
|
||||
new TINK.Model.Station.Station("4", new List<string>(), null),
|
||||
new TINK.Model.Station.Station("FR103", new List<string>(), null), // Was station id 4 before switching from data provider CopriCallsMemory(SampleSets.Set2, 1, ...)
|
||||
() => tinkApp.GetIsConnected(),
|
||||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
|
@ -878,14 +882,14 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Assert.IsTrue(new List<string> { "Updating...", string.Empty }.Contains(bikesAtStation.StatusInfoText));
|
||||
|
||||
// Verify list of bikes
|
||||
Assert.AreEqual(4, bikesAtStation.Count);
|
||||
Assert.AreEqual(4, bikesAtStation.Count); // Count of bikes was 4 before switching from data provider CopriCallsMemory(SampleSets.Set2, 1, ...)
|
||||
Assert.IsTrue(bikesAtStation.IsIdle);
|
||||
Assert.IsTrue(bikesAtStation.IsBikesListVisible, "If there are any bikes, list must be visible.");
|
||||
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "5").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "14").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "26").StateText);
|
||||
Assert.AreEqual("Code 2931, rented since 28. November 13:06.", bikesAtStation.FirstOrDefault(x => x.Id == "7").StateText);
|
||||
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
|
||||
|
||||
// Login hint/ no bikes frame
|
||||
Assert.IsFalse(bikesAtStation.IsLoginRequiredHintVisible);
|
||||
|
@ -909,15 +913,15 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, 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(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -934,7 +938,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
permissions,
|
||||
bluetooth,
|
||||
Device.iOS,
|
||||
new TINK.Model.Station.Station("4", new List<string>(), null),
|
||||
new TINK.Model.Station.Station("FR103", new List<string>(), null), // Was station id 4 before switching from data provider CopriCallsMemory(SampleSets.Set2, 1
|
||||
() => tinkApp.GetIsConnected(),
|
||||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
|
@ -950,13 +954,12 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Assert.AreEqual("Offline.", bikesAtStation.StatusInfoText);
|
||||
|
||||
// Verify list of bikes
|
||||
Assert.AreEqual(3, bikesAtStation.Count);
|
||||
Assert.AreEqual(2, bikesAtStation.Count); // Count of bikes was 3. There is no more bike with id 26.
|
||||
Assert.IsTrue(bikesAtStation.IsIdle);
|
||||
Assert.IsTrue(bikesAtStation.IsBikesListVisible, "If there are any bikes, list must be visible.");
|
||||
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "5").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "14").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "26").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR9999").StateText); // Was id 5
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR9998").StateText); // Was is 14
|
||||
|
||||
// Login hint/ no bikes frame
|
||||
Assert.IsTrue(bikesAtStation.IsLoginRequiredHintVisible);
|
||||
|
@ -980,8 +983,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
|
@ -998,7 +1001,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
TinkApp.MerchantId,
|
||||
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default",
|
||||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
|
@ -1016,7 +1019,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
permissions,
|
||||
bluetooth,
|
||||
Device.iOS,
|
||||
new TINK.Model.Station.Station("4", new List<string>(), null),
|
||||
new TINK.Model.Station.Station("FR103", new List<string>(), null), // Was station id 4 before switching from data provider CopriCallsCacheMemory()
|
||||
() => tinkApp.GetIsConnected(),
|
||||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
|
@ -1035,13 +1038,12 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Assert.AreEqual("Connection interrupted, server unreachable.", bikesAtStation.StatusInfoText);
|
||||
|
||||
// Verify list of bikes
|
||||
Assert.AreEqual(3, bikesAtStation.Count);
|
||||
Assert.AreEqual(2, bikesAtStation.Count); // Count of bikes was 3. There is no more bike with id 26.
|
||||
Assert.IsTrue(bikesAtStation.IsIdle);
|
||||
Assert.IsTrue(bikesAtStation.IsBikesListVisible, "If there are any bikes, list must be visible.");
|
||||
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "5").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "14").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "26").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR9999").StateText); // Was id 5
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR9998").StateText); // Was is 14
|
||||
|
||||
// Login hint/ no bikes frame
|
||||
Assert.IsTrue(bikesAtStation.IsLoginRequiredHintVisible);
|
||||
|
@ -1065,8 +1067,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var tinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.Off } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { FilterHelper.FILTERTINKGENERAL, FilterState.On }, { FilterHelper.FILTERKONRAD, FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000),
|
||||
true),
|
||||
|
@ -1084,7 +1086,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
TinkApp.MerchantId,
|
||||
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default",
|
||||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
|
@ -1102,7 +1104,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
permissions,
|
||||
bluetooth,
|
||||
Device.iOS,
|
||||
new TINK.Model.Station.Station("4", new List<string>(), null),
|
||||
new TINK.Model.Station.Station("FR103", new List<string>(), null), // Was station id 4 before switching from data provider CopriCallsCacheMemory()
|
||||
() => tinkApp.GetIsConnected(),
|
||||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
|
@ -1121,13 +1123,12 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Assert.AreEqual("Connection interrupted.", bikesAtStation.StatusInfoText);
|
||||
|
||||
// Verify list of bikes
|
||||
Assert.AreEqual(3, bikesAtStation.Count);
|
||||
Assert.AreEqual(2, bikesAtStation.Count); // Count of bikes was 3. There is no more bike with id 26.
|
||||
Assert.IsTrue(bikesAtStation.IsIdle);
|
||||
Assert.IsTrue(bikesAtStation.IsBikesListVisible, "If there are any bikes, list must be visible.");
|
||||
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "5").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "14").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "26").StateText);
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR9999").StateText); // Was id 5
|
||||
Assert.AreEqual("Available.", bikesAtStation.FirstOrDefault(x => x.Id == "FR9998").StateText); // Was id 14.
|
||||
|
||||
// Login hint/ no bikes frame
|
||||
Assert.IsTrue(bikesAtStation.IsLoginRequiredHintVisible);
|
||||
|
|
|
@ -4,9 +4,6 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TestTINKLib.Mocks.Connector;
|
||||
using TestTINKLib.Mocks.Device;
|
||||
using TestTINKLib.Mocks.Services;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository.Exception;
|
||||
|
@ -27,6 +24,11 @@ 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;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
||||
{
|
||||
|
@ -600,7 +602,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var myBikes = new MyBikesPageViewModel(
|
||||
tinkApp.ActiveUser,
|
||||
null, // Permissions,
|
||||
permissions, // Permissions,
|
||||
bluetooth,
|
||||
Device.iOS,
|
||||
() => tinkApp.GetIsConnected(),
|
||||
|
@ -674,7 +676,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var myBikes = new MyBikesPageViewModel(
|
||||
tinkApp.ActiveUser,
|
||||
null, // Permissions,
|
||||
permissions, // Permissions,
|
||||
bluetooth,
|
||||
Device.iOS,
|
||||
() => tinkApp.GetIsConnected(),
|
||||
|
@ -751,7 +753,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var myBikes = new MyBikesPageViewModel(
|
||||
tinkApp.ActiveUser,
|
||||
null, // Permissions,
|
||||
permissions, // Permissions,
|
||||
bluetooth,
|
||||
Device.iOS,
|
||||
() => tinkApp.GetIsConnected(),
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
using System;
|
||||
using TINK.Model;
|
||||
using TINK.Repository;
|
||||
using TestFramework.Model.Device;
|
||||
|
||||
namespace TestTINKLib.Fixtures.UseCases.ConnectedOffline
|
||||
{
|
||||
using NSubstitute;
|
||||
using TestTINKLib.Mocks.Device;
|
||||
using TestTINKLib.Mocks.Services;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Services.BluetoothLock;
|
||||
using TestFramework.Services.Permissions;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Services.Geolocation;
|
||||
using TINK.Services;
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
using TINK.Model.Connector;
|
||||
using TestTINKLib.Mocks.Device;
|
||||
using System;
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
using System.Collections.Generic;
|
||||
using TestTINKLib.Mocks.Services;
|
||||
using TINK.Repository;
|
||||
using TINK.ViewModel.Settings;
|
||||
using NSubstitute;
|
||||
using TINK.Services;
|
||||
using TINK.Model.Services.Geolocation;
|
||||
using TestFramework.Model.Device;
|
||||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Services.BluetoothLock;
|
||||
using TestFramework.Services.Permissions;
|
||||
|
||||
namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
||||
{
|
||||
|
|
|
@ -1,379 +0,0 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
|
||||
using TINK.Model.User.Account;
|
||||
using TestTINKLib.Model.User.Account;
|
||||
using TINK.Model.Connector;
|
||||
using TestTINKLib.Mocks.Device;
|
||||
using System;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Bike;
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
using TINK.Model.State;
|
||||
using System.Collections.Generic;
|
||||
using TestTINKLib.Mocks.Services;
|
||||
using TINK.Repository;
|
||||
using TINK.ViewModel.Map;
|
||||
using TINK.ViewModel.Settings;
|
||||
using NSubstitute;
|
||||
using TINK.Services;
|
||||
using TINK.Model.Services.Geolocation;
|
||||
|
||||
namespace TestTINKLib.Fixtures.UseCases.Startup
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestTinkApp
|
||||
{
|
||||
[Test]
|
||||
public void NotLoggedIn()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory(SampleSets.Set2, 1));
|
||||
|
||||
var l_oTinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
new SpecialFolderMock(),
|
||||
null, // Cipher
|
||||
isConnectedFunc: () => true,
|
||||
currentVersion: new Version(3, 2, 0, 115), // Current app version
|
||||
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
|
||||
|
||||
var l_oStations = l_oTinkApp.GetConnector(true).Query.GetBikesAndStationsAsync().Result.Response;
|
||||
|
||||
// Check stations.
|
||||
Assert.AreEqual(8, l_oStations.StationsAll.Count);
|
||||
Assert.NotNull(l_oStations.StationsAll.GetById("4"));
|
||||
Assert.AreEqual("4", l_oStations.StationsAll.GetById("4").Id);
|
||||
Assert.AreEqual(new Position(47.6586936667, 9.16863116667), l_oStations.StationsAll.GetById("4").Position);
|
||||
|
||||
// Verify selected station.
|
||||
Assert.AreEqual(
|
||||
null,
|
||||
l_oTinkApp.SelectedStation.Id,
|
||||
"When starting app selected station must always be invlid");
|
||||
|
||||
// Verify bikes at station.
|
||||
Assert.AreEqual(
|
||||
0,
|
||||
TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count,
|
||||
"If no station is selected BikesAtStation- list count must be zero");
|
||||
|
||||
// Check my bikes.
|
||||
Assert.IsFalse(l_oTinkApp.ActiveUser.IsLoggedIn);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LoggedIn_BikesReservedBooked()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
"4da3044c8657a04ba60e2eaa753bc51a",
|
||||
"javaminister@gmail.com",
|
||||
new CopriCallsMemory(SampleSets.Set2, 1, "4da3044c8657a04ba60e2eaa753bc51a"));
|
||||
|
||||
// User logged in is initial state to verify.
|
||||
var l_oTinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"), new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new Account("javaminister@gmail.com", "javaminister" /* password */, "4da3044c8657a04ba60e2eaa753bc51a" /* session cookie */, new List<string> { "TINK", "Konrad" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, "4da3044c8657a04ba60e2eaa753bc51a")),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
new SpecialFolderMock(),
|
||||
null, // Cipher
|
||||
isConnectedFunc: () => true,
|
||||
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
|
||||
|
||||
var l_oStations = l_oTinkApp.GetConnector(true).Query.GetBikesAndStationsAsync().Result.Response;
|
||||
|
||||
// Check stations.
|
||||
Assert.AreEqual(8, l_oStations.StationsAll.Count);
|
||||
Assert.NotNull(l_oStations.StationsAll.GetById("4"));
|
||||
Assert.AreEqual("4", l_oStations.StationsAll.GetById("4").Id);
|
||||
Assert.AreEqual(new Position(47.6586936667, 9.16863116667), l_oStations.StationsAll.GetById("4").Position);
|
||||
|
||||
// Verify selected station.
|
||||
Assert.AreEqual(
|
||||
null,
|
||||
l_oTinkApp.SelectedStation.Id,
|
||||
"When starting app selected station must always be invlid");
|
||||
|
||||
// Verify bikes at station.
|
||||
Assert.AreEqual(
|
||||
0,
|
||||
TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count,
|
||||
"If no station is selected BikesAtStation- list count must be zero");
|
||||
|
||||
// Check my bikes
|
||||
var l_oBikes = l_oTinkApp.GetConnector(true).Query.GetBikesOccupiedAsync().Result.Response;
|
||||
Assert.AreEqual(2, l_oBikes.Count);
|
||||
Assert.AreEqual("8", l_oBikes.GetById("8").Id);
|
||||
Assert.AreEqual(InUseStateEnum.Booked, l_oBikes.GetById("8").State.Value);
|
||||
Assert.AreEqual("5", l_oBikes.GetById("8").CurrentStation);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikes.GetById("8").TypeOfBike);
|
||||
Assert.AreEqual(WheelType.Two, l_oBikes.GetById("8").WheelType);
|
||||
Assert.AreEqual("7", l_oBikes.GetById("7").Id);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LoggedIn_AllBikesDisposable_FilterTINK()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
"1234",
|
||||
"mgrimm@gmail.com",
|
||||
new CopriCallsMemory(SampleSets.Set2, 1));
|
||||
|
||||
// No user logged in is initial state to verify.
|
||||
var l_oTinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new Uri("https://app.tink-konstanz.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new Account("mgrimm@gmail.com", "123456789" /* password */, "1234" /* session cookie */, new List<string> { "TINK", "Konrad" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
new SpecialFolderMock(),
|
||||
null, // Cipher
|
||||
isConnectedFunc: () => true,
|
||||
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
|
||||
|
||||
var l_oStations = l_oTinkApp.GetConnector(true).Query.GetBikesAndStationsAsync().Result.Response;
|
||||
|
||||
// Check stations.
|
||||
Assert.AreEqual(8, l_oStations.StationsAll.Count);
|
||||
Assert.NotNull(l_oStations.StationsAll.GetById("4"));
|
||||
Assert.AreEqual("4", l_oStations.StationsAll.GetById("4").Id);
|
||||
Assert.AreEqual(new Position(47.6586936667, 9.16863116667), l_oStations.StationsAll.GetById("4").Position);
|
||||
|
||||
// Verify selected station.
|
||||
Assert.AreEqual(
|
||||
null,
|
||||
l_oTinkApp.SelectedStation.Id,
|
||||
"When starting app selected station must always be invlid");
|
||||
|
||||
// Verify bikes at station.
|
||||
Assert.AreEqual(
|
||||
0,
|
||||
TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count,
|
||||
"If no station is selected BikesAtStation- list count must be zero");
|
||||
|
||||
// Check my bikes
|
||||
Assert.IsTrue(l_oTinkApp.ActiveUser.IsLoggedIn);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LoggedIn_AllBikesDisposable_FilterKonrad()
|
||||
{
|
||||
var l_oCopriServer = new CopriCallsMemory(SampleSets.Set2, 1);
|
||||
var l_oConnector = new ConnectorCache(
|
||||
"1234",
|
||||
"mgrimm@gmail.com",
|
||||
new CopriCallsMemory(SampleSets.Set2, 1));
|
||||
|
||||
// No user logged in is initial state to verify.
|
||||
var l_oTinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "Konrad", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new Uri("https://app.tink-konstanz.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new Account("mgrimm@gmail.com", "123456789" /* password */, "1234" /* session cookie */, new List<string> { "TINK", "Konrad" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
new SpecialFolderMock(),
|
||||
null, // Cipher
|
||||
isConnectedFunc: () => true,
|
||||
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
|
||||
|
||||
var l_oStations = l_oTinkApp.GetConnector(true).Query.GetBikesAndStationsAsync().Result.Response;
|
||||
|
||||
// Check stations.
|
||||
Assert.AreEqual(2, l_oStations.StationsAll.Count);
|
||||
Assert.NotNull(l_oStations.StationsAll.GetById("14"));
|
||||
Assert.AreEqual("14", l_oStations.StationsAll.GetById("14").Id);
|
||||
Assert.AreEqual(new Position(47.66698054007847, 9.169303178787231), l_oStations.StationsAll.GetById("14").Position);
|
||||
|
||||
// Verify selected station.
|
||||
Assert.AreEqual(
|
||||
null,
|
||||
l_oTinkApp.SelectedStation.Id,
|
||||
"When starting app selected station must always be invlid");
|
||||
|
||||
// Verify bikes at station.
|
||||
Assert.AreEqual(
|
||||
0,
|
||||
TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count,
|
||||
"If no station is selected BikesAtStation- list count must be zero");
|
||||
|
||||
// Check my bikes
|
||||
Assert.IsTrue(l_oTinkApp.ActiveUser.IsLoggedIn);
|
||||
}
|
||||
|
||||
[Test, Ignore("Todo: Check if reserved bikes are released even if system is offline.")]
|
||||
public void LoggedIn_BikesReserved_OfflineAfterStart()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test if Whats New logic works as expected. Form version 3.0.0.115 or smaller no Whats New dialog existed.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void FirstInstall_WhatsNew()
|
||||
{
|
||||
var l_oAppVersion = new Version(3, 2, 0, 120);
|
||||
|
||||
var l_oTinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
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)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
null, // use default locks service
|
||||
new DeviceMock(),
|
||||
new SpecialFolderMock(),
|
||||
null, // Cipher
|
||||
#if ARENDI
|
||||
Substitute.For<ICentral>(),
|
||||
#endif
|
||||
isConnectedFunc: () => true,
|
||||
currentVersion: l_oAppVersion, // Current app version
|
||||
lastVersion: null, // Last version.
|
||||
whatsNewShownInVersion: null); // First install.
|
||||
|
||||
// Whats new page
|
||||
Assert.IsFalse(
|
||||
l_oTinkApp.WhatsNew.IsShowRequired,
|
||||
$"Whats new should not be displayed because first install has been detected.");
|
||||
|
||||
// Call member which view model calls when using app.
|
||||
l_oTinkApp.SetWhatsNewWasShown();
|
||||
|
||||
// Whats new page
|
||||
Assert.IsFalse(
|
||||
l_oTinkApp.WhatsNew.IsShowRequired,
|
||||
$"Whats new should mot be displayed first install detected.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Upgrade120_WhatsNew()
|
||||
{
|
||||
var l_oAppVersion = new Version(3, 0, 0, 120);
|
||||
Version lastVersion = new Version(3, 0, 0, 116);
|
||||
|
||||
var l_oTinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
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)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
null, // use default locks service
|
||||
new DeviceMock(),
|
||||
new SpecialFolderMock(),
|
||||
null, // Cipher
|
||||
#if ARENDI // Requires LockItArendi library.
|
||||
Substitute.For<ICentral>(),
|
||||
#endif
|
||||
isConnectedFunc: () => true,
|
||||
currentVersion: l_oAppVersion, // Current app version
|
||||
lastVersion: lastVersion,
|
||||
whatsNewShownInVersion: null); // Whats new page was never shown.
|
||||
|
||||
// Whats new page
|
||||
Assert.IsTrue(
|
||||
l_oTinkApp.WhatsNew.IsShowRequired,
|
||||
$"Whats new should be displayed because app version is {l_oAppVersion} and version when \"Whats New\" was shown last is {lastVersion} (null means never).");
|
||||
|
||||
// Call member which view model calls when using app.
|
||||
l_oTinkApp.SetWhatsNewWasShown();
|
||||
|
||||
// Whats new page
|
||||
Assert.IsFalse(
|
||||
l_oTinkApp.WhatsNew.IsShowRequired,
|
||||
$"Whats new should mot be displayed because app version is {l_oAppVersion} and version when \"Whats New\" was shown last is {lastVersion} equals.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SubsequentStart_WhatsNew()
|
||||
{
|
||||
var l_oAppVersion = new Version(3, 2, 0, 115);
|
||||
var l_oWhatsNewVersion = new Version(3, 2, 0, 115);
|
||||
|
||||
var l_oTinkApp = new TinkApp(
|
||||
new TINK.Model.Settings.Settings(
|
||||
new GroupFilterMapPage(new Dictionary<string, FilterState> { { "TINK", FilterState.On } }),
|
||||
new GroupFilterSettings(new Dictionary<string, FilterState> { { "TINK", FilterState.On }, { "Konrad", FilterState.On } }),
|
||||
new Uri("https://shareeapp-primary.copri-bike.de/APIjsonserver"),
|
||||
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
|
||||
Serilog.Events.LogEventLevel.Error,
|
||||
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)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
null, // use default locks service
|
||||
new DeviceMock(),
|
||||
new SpecialFolderMock(),
|
||||
null, // Cipher
|
||||
#if ARENDI // Requires LockItArendi library.
|
||||
Substitute.For<ICentral>(),
|
||||
#endif
|
||||
isConnectedFunc: () => true,
|
||||
currentVersion: l_oAppVersion, // Current app version<
|
||||
lastVersion: l_oWhatsNewVersion); // Whats new page was never shown.
|
||||
|
||||
// Whats new page
|
||||
Assert.IsFalse(
|
||||
l_oTinkApp.WhatsNew.IsShowRequired,
|
||||
$"Whats new should not be displayed because app version is {l_oAppVersion} and version when \"Whats New\" was shown last is {l_oWhatsNewVersion} equals.");
|
||||
|
||||
// Call member which view model would call if Whats New would have been shonw.
|
||||
l_oTinkApp.SetWhatsNewWasShown();
|
||||
|
||||
// Whats new page
|
||||
Assert.IsFalse(
|
||||
l_oTinkApp.WhatsNew.IsShowRequired,
|
||||
$"Whats new should mot be displayed because app version is {l_oAppVersion} and version when \"Whats New\" was shown last is {l_oWhatsNewVersion} equals.");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue