mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-15 06:36:38 +01:00
82 lines
3.5 KiB
C#
82 lines
3.5 KiB
C#
using System;
|
|
using NUnit.Framework;
|
|
using Rhino.Mocks;
|
|
using TestFramework.Model.Services.Geolocation;
|
|
using TestFramework.Services.BluetoothLock;
|
|
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
|
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
|
|
using TINK.Model.Device;
|
|
using TINK.Model.User;
|
|
using TINK.ViewModel;
|
|
using TINK.ViewModel.Bikes;
|
|
using TINK.ViewModel.Bikes.Bike;
|
|
|
|
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|
{
|
|
[TestFixture]
|
|
public class TestBikeViewModelFactory
|
|
{
|
|
[Test]
|
|
public void TestCreateBluetoothLock()
|
|
{
|
|
Assert.AreEqual(
|
|
typeof(TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel),
|
|
BikeViewModelFactory.Create(
|
|
() => false, // Is connected delegate,
|
|
(isconnected) => null, // connectorFactory
|
|
new GeolocationMock(), // geolocation
|
|
new LocksServiceMock(), // lock service
|
|
(index) => { }, // bikeRemoveDelegate
|
|
null, // viewUpdateManager
|
|
NSubstitute.Substitute.For<ISmartDevice>(),
|
|
null, // viewService
|
|
new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfoMutable(new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("42", TINK.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt), new Drive(), 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42"), "My Station Name"),
|
|
MockRepository.GenerateStub<IUser>(), // user
|
|
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
|
|
MockRepository.GenerateStub<IBikesViewModel>(),
|
|
url => { }).GetType()); // stateInfoProvider
|
|
}
|
|
|
|
[Test]
|
|
public void TestCreateCopri()
|
|
{
|
|
Assert.AreEqual(
|
|
typeof(TINK.ViewModel.Bikes.Bike.CopriLock.BikeViewModel),
|
|
BikeViewModelFactory.Create(
|
|
() => false, // Is connected delegate,
|
|
(isconnected) => null, // connectorFactory
|
|
new GeolocationMock(), // geolocation
|
|
new LocksServiceMock(), // lock service
|
|
(index) => { }, // bikeRemoveDelegate
|
|
null, // viewUpdateManager
|
|
NSubstitute.Substitute.For<ISmartDevice>(),
|
|
null, // viewService
|
|
new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfoMutable(new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("42", LockModel.ILockIt), new Drive(), "17", new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo.Builder { State = TINK.Model.Bikes.BikeInfoNS.CopriLock.LockingState.Closed }.Build()), "My Station Name"),
|
|
MockRepository.GenerateStub<IUser>(), // user
|
|
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
|
|
MockRepository.GenerateStub<IBikesViewModel>(),
|
|
url => { }).GetType()); // stateInfoProvider
|
|
}
|
|
|
|
[Test]
|
|
public void TestCreateUnsupported()
|
|
{
|
|
Assert.That(
|
|
BikeViewModelFactory.Create(
|
|
() => false, // Is connected delegate,
|
|
(isconnected) => null, // connectorFactory
|
|
new GeolocationMock(), // geolocation
|
|
new LocksServiceMock(), // lock service
|
|
(index) => { }, // bikeRemoveDelegate
|
|
null, // viewUpdateManager
|
|
NSubstitute.Substitute.For<ISmartDevice>(),
|
|
null, // viewService
|
|
new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("42", TINK.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt), new Drive(), 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42"), "My Station Name"),
|
|
MockRepository.GenerateStub<IUser>(), // user
|
|
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
|
|
MockRepository.GenerateStub<IBikesViewModel>(),
|
|
url => { }),
|
|
Is.Null);
|
|
}
|
|
}
|
|
}
|