mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 10:36:30 +01:00
84 lines
2.1 KiB
C#
84 lines
2.1 KiB
C#
using System.Threading.Tasks;
|
|
using MonkeyCache.FileStore;
|
|
using Newtonsoft.Json;
|
|
using NUnit.Framework;
|
|
using TINK.Repository;
|
|
using TINK.Repository.Response;
|
|
using TINK.Repository.Response.Stations;
|
|
|
|
namespace UITest.Fixtures.ObjectTests.Connector
|
|
{
|
|
[TestFixture]
|
|
public class TestCopriCallsMonkeyStore
|
|
{
|
|
[Test]
|
|
public void TestConstruct()
|
|
{
|
|
var bikesAvailable = JsonConvert.DeserializeObject<BikesAvailableResponse>(CopriCallsMonkeyStore.BIKESAVAILABLE);
|
|
Assert.NotNull(bikesAvailable?.bikes);
|
|
|
|
var bikesOccupied = JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(CopriCallsMonkeyStore.BIKESOCCUPIED);
|
|
Assert.NotNull(bikesOccupied?.bikes_occupied);
|
|
|
|
var stations = JsonConvert.DeserializeObject<StationsAvailableResponse>(CopriCallsMonkeyStore.STATIONSALL);
|
|
Assert.NotNull(stations?.stations);
|
|
}
|
|
|
|
[Test]
|
|
public async Task TestGetStations()
|
|
{
|
|
if (string.IsNullOrEmpty(Barrel.ApplicationId))
|
|
{
|
|
Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
|
|
}
|
|
|
|
try
|
|
{
|
|
var cache = new CopriCallsMonkeyStore("123456789", null /*UI language */);
|
|
Assert.AreEqual(0, (await cache.GetStationsAsync()).stations.Count);
|
|
}
|
|
finally
|
|
{
|
|
Barrel.Current.EmptyAll();
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task TestGetBikesAvailable()
|
|
{
|
|
if (string.IsNullOrEmpty(Barrel.ApplicationId))
|
|
{
|
|
Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
|
|
}
|
|
|
|
try
|
|
{
|
|
var cache = new CopriCallsMonkeyStore("123456789", null /*UI language */);
|
|
Assert.AreEqual(0, (await cache.GetBikesAvailableAsync()).bikes.Count);
|
|
}
|
|
finally
|
|
{
|
|
Barrel.Current.EmptyAll();
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task TestGetBikesOccupied()
|
|
{
|
|
if (string.IsNullOrEmpty(Barrel.ApplicationId))
|
|
{
|
|
Barrel.ApplicationId = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
|
|
}
|
|
|
|
try
|
|
{
|
|
var cache = new CopriCallsMonkeyStore("123456789", "abc");
|
|
Assert.AreEqual(0, (await cache.GetBikesOccupiedAsync()).bikes_occupied.Count);
|
|
}
|
|
finally
|
|
{
|
|
Barrel.Current.EmptyAll();
|
|
}
|
|
}
|
|
}
|
|
}
|