public void SetUp() { // Init Tiny IoC var container = new TinyIoCContainer(); container.Register <IDependencyContainer>(new TinyContainer(container)); var resolver = new TinyResolver(container); // Init IoC Builder var builder = new TestContainerBuilder(resolver); MvvmMobile.Core.Mvvm.Api.Init(builder); // Register builder.Register <IEditMotorcycleViewModel, EditMotorcycleViewModel>(); builder.Register <IMotorcyclePayload, MotorcyclePayload>(); _navigation = Substitute.For <ICustomNavigation>(); builder.Register(_navigation); var coreNav = Substitute.For <INavigation>(); coreNav.When(x => x.NavigateBack(Arg.Any <Action>(), Arg.Any <BackBehaviour>())) .Do(x => _navigation.NavigateBack((Action)x[0], (BackBehaviour)x[1])); coreNav.When(x => x.NavigateBack(Arg.Any <Action <Guid> >(), Arg.Any <Guid>(), Arg.Any <Action>(), Arg.Any <BackBehaviour>())) .Do(x => _navigation.NavigateBack((Action <Guid>)x[0], (Guid)x[1], (Action)x[2], (BackBehaviour)x[3])); builder.Register(coreNav); builder.Register <IMotorcyclePayload, MotorcyclePayload>(); _payload = builder.Resolver.Resolve <IMotorcyclePayload>(); builder.Register <IPayloads, Payloads>(); _payloads = builder.Resolver.Resolve <IPayloads>(); _subject = builder.Resolver.Resolve <IEditMotorcycleViewModel>(); }
public void SetUp() { // Init Tiny IoC var container = new TinyIoCContainer(); container.Register <IDependencyContainer>(new TinyContainer(container)); var resolver = new TinyResolver(container); // Init IoC Builder var builder = new TestContainerBuilder(resolver); MvvmMobile.Core.Mvvm.Api.Init(builder); // Register builder.Register <IStartViewModel, StartViewModel>(); builder.Register <IMotorcyclePayload, MotorcyclePayload>(); _navigation = Substitute.For <INavigation>(); builder.Register(_navigation); _subject = builder.Resolver.Resolve <IStartViewModel>(); }