sharee.bike-App/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeViewModelFactory.cs

53 lines
2.4 KiB
C#
Raw Normal View History

2021-07-12 21:31:46 +02:00
using NUnit.Framework;
using Rhino.Mocks;
using System;
using TestTINKLib.Mocks.Services;
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
new TINK.Model.Bike.BC.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42")),
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
new TINK.Model.Bike.BluetoothLock.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42")),
MockRepository.GenerateStub<IUser>(), // user
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
MockRepository.GenerateStub<IBikesViewModel>()).GetType()); // stateInfoProvider
}
}
}