mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 10:36:30 +01:00
83 lines
2.5 KiB
C#
83 lines
2.5 KiB
C#
using MonkeyCache.FileStore;
|
|
using Newtonsoft.Json;
|
|
using NUnit.Framework;
|
|
using System.Threading.Tasks;
|
|
using TINK.Repository;
|
|
using TINK.Repository.Response;
|
|
|
|
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<StationsAllResponse>(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");
|
|
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");
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
}
|