コード例 #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));
        }
コード例 #2
0
        public void ResolveForViewTypeWhenDifferentAssembly()
        {
            PageNavigationTypeResolver.AssignAssemblies <TestPage, TestPageViewModel>();
            var actual = PageNavigationTypeResolver.ResolveForViewType <TestPageViewModel>();

            Assert.Equal(typeof(TestPage), actual);
        }
コード例 #3
0
        public void Clear()
        {
            PageNavigationTypeResolver.AssignAssemblies <TestPage, TestPageViewModel>();
            PageNavigationTypeResolver.Clear();

            Assert.Null(PageNavigationTypeResolver.ResolveForViewModelType(typeof(TestPage)));
            Assert.Null(PageNavigationTypeResolver.ResolveForViewType <TestPageViewModel>());
        }
コード例 #4
0
        public void ResolveForViewTypeWhenPageOfSameAssembly()
        {
            var actual = PageNavigationTypeResolver.ResolveForViewType <MockPageViewModel>();

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