2021-07-12 21:31:46 +02:00
using NUnit.Framework ;
using Rhino.Mocks ;
using System ;
2021-11-14 23:27:29 +01:00
using TestFramework.Model.Services.Geolocation ;
using TestFramework.Services.BluetoothLock ;
2021-07-12 21:31:46 +02:00
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 TestCreate ( )
{
Assert . AreEqual (
typeof ( TINK . ViewModel . Bikes . Bike . BC . 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
2022-01-04 18:59:16 +01:00
new TINK . Model . Bike . BC . BikeInfoMutable ( new TINK . Model . Bike . BluetoothLock . BikeInfo ( "42" , 5200544 , new Guid ( "00000000-0000-0000-0000-000000000001" ) , "42" ) , "My Station Name" ) ,
2021-07-12 21:31:46 +02:00
MockRepository . GenerateStub < IUser > ( ) , // user
MockRepository . GenerateStub < IInUseStateInfoProvider > ( ) ,
MockRepository . GenerateStub < IBikesViewModel > ( ) ) . GetType ( ) ) ; // stateInfoProvider
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
2022-01-04 18:59:16 +01:00
new TINK . Model . Bike . BluetoothLock . BikeInfoMutable ( new TINK . Model . Bike . BluetoothLock . BikeInfo ( "42" , 5200544 , new Guid ( "00000000-0000-0000-0000-000000000001" ) , "42" ) , "My Station Name" ) ,
2021-07-12 21:31:46 +02:00
MockRepository . GenerateStub < IUser > ( ) , // user
MockRepository . GenerateStub < IInUseStateInfoProvider > ( ) ,
MockRepository . GenerateStub < IBikesViewModel > ( ) ) . GetType ( ) ) ; // stateInfoProvider
}
}
}