-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests for Idiom and Platform specific View registrations
- Loading branch information
Showing
5 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Source/Xamarin/Prism.DI.Forms.Tests/Mocks/PrismApplicationMockPlatformAware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Prism.DI.Forms.Tests.Mocks.Modules; | ||
using Prism.DI.Forms.Tests.Mocks.Services; | ||
using Prism.DI.Forms.Tests.Mocks.ViewModels; | ||
using Prism.DI.Forms.Tests.Mocks.Views; | ||
using Prism.Ioc; | ||
using Prism.Modularity; | ||
using Prism.Navigation; | ||
using Xamarin.Forms; | ||
using Prism.Logging; | ||
using Prism.Forms.Tests.Mocks.Logging; | ||
using Prism.Mvvm; | ||
#if Autofac | ||
using Prism.Autofac; | ||
using Autofac; | ||
#elif DryIoc | ||
using Prism.DryIoc; | ||
using DryIoc; | ||
#elif Ninject | ||
using Prism.Ninject; | ||
using Ninject; | ||
#elif Unity | ||
using Prism.Unity; | ||
using Unity; | ||
#endif | ||
|
||
namespace Prism.DI.Forms.Tests | ||
{ | ||
public class PrismApplicationMockPlatformAware : PrismApplicationMock | ||
{ | ||
public PrismApplicationMockPlatformAware(IPlatformInitializer platformInitializer) | ||
: base(platformInitializer) | ||
{ | ||
} | ||
|
||
public PrismApplicationMockPlatformAware(IPlatformInitializer platformInitializer, Page startPage) | ||
: base(platformInitializer, startPage) | ||
{ | ||
} | ||
|
||
protected override void RegisterTypes(IContainerRegistry containerRegistry) | ||
{ | ||
containerRegistry.RegisterForNavigation<NavigationPage>(); | ||
|
||
containerRegistry.RegisterForNavigationOnIdiom<AutowireView, AutowireViewModel>(tabletView: typeof(AutowireViewTablet)); | ||
containerRegistry.RegisterForNavigationOnPlatform<ViewAMock, ViewModelAMock>(new Platform<ViewAMockAndroid>(AppModel.RuntimePlatform.Android)); | ||
|
||
DependencyService.Register<IDependencyServiceMock, DependencyServiceMock>(); | ||
ViewModelLocationProvider.Register<PartialView, PartialViewModel>(); | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Source/Xamarin/Prism.DI.Forms.Tests/Mocks/Views/AutowireViewTablet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Prism.Mvvm; | ||
using Xamarin.Forms; | ||
|
||
namespace Prism.DI.Forms.Tests.Mocks.Views | ||
{ | ||
public class AutowireViewTablet : Page | ||
{ | ||
public AutowireViewTablet() | ||
{ | ||
ViewModelLocator.SetAutowireViewModel(this, true); | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Source/Xamarin/Prism.DI.Forms.Tests/Mocks/Views/ViewAMockAndroid.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Prism.Mvvm; | ||
using Xamarin.Forms; | ||
|
||
namespace Prism.DI.Forms.Tests.Mocks.Views | ||
{ | ||
public class ViewAMockAndroid : Page | ||
{ | ||
public ViewAMockAndroid() | ||
{ | ||
ViewModelLocator.SetAutowireViewModel(this, true); | ||
} | ||
} | ||
} |