mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-24 21:56:29 +02:00
Legacy testing lib added..
This commit is contained in:
parent
0167fc321f
commit
47ed05837e
118 changed files with 17505 additions and 0 deletions
72
TestTINKLib/Fixtures/UseCases/SelectStation/TestTinkApp.cs
Normal file
72
TestTINKLib/Fixtures/UseCases/SelectStation/TestTinkApp.cs
Normal file
|
@ -0,0 +1,72 @@
|
|||
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;
|
||||
|
||||
namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
||||
{
|
||||
|
||||
[TestFixture]
|
||||
public class TestTinkApp
|
||||
{
|
||||
[Test]
|
||||
public void TestBikesAtStation_AccountStoreMock_NoUser_CopriMock_Set2()
|
||||
{
|
||||
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 TINK.ViewModel.Map.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(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
|
||||
new PermissionsMock(),
|
||||
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
|
||||
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Station.Station("5", new List<string>(), null);
|
||||
Assert.AreEqual(3, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual("25", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("25").Id);
|
||||
Assert.AreEqual("11", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("11").Id);
|
||||
Assert.AreEqual("2", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("2").Id);
|
||||
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Station.Station("10", new List<string>(), null);
|
||||
|
||||
Assert.AreEqual(
|
||||
1,
|
||||
TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
|
||||
Assert.AreEqual("18", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("18").Id);
|
||||
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Station.Station("91345", new List<string>(), null);
|
||||
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue