Exemple #1
0
        public static IUnityContainer RegisterTypeForNavigationFromViewModel <TViewModel>(this IUnityContainer container) where TViewModel : class
        {
            var viewType = PageNavigationTypeResolver.ResolveForViewType <TViewModel>();
            var name     = PageNavigationNameResolver.Resolve <TViewModel>();

            return(container.RegisterTypeForNavigation(viewType, name));
        }
        public void ResolveForViewTypeWhenDifferentAssembly()
        {
            PageNavigationTypeResolver.AssignAssemblies <TestPage, TestPageViewModel>();
            var actual = PageNavigationTypeResolver.ResolveForViewType <TestPageViewModel>();

            Assert.Equal(typeof(TestPage), actual);
        }
        public void Clear()
        {
            PageNavigationTypeResolver.AssignAssemblies <TestPage, TestPageViewModel>();
            PageNavigationTypeResolver.Clear();

            Assert.Null(PageNavigationTypeResolver.ResolveForViewModelType(typeof(TestPage)));
            Assert.Null(PageNavigationTypeResolver.ResolveForViewType <TestPageViewModel>());
        }
        public void ResolveForViewTypeWhenPageOfSameAssembly()
        {
            var actual = PageNavigationTypeResolver.ResolveForViewType <MockPageViewModel>();

            Assert.Equal(typeof(MockPage), actual);
        }