Exemple #1
0
        public void ResolveExplicitViewType()
        {
            RxApp.ConfigureServiceLocator(
                (x, _) => (x.Name == "IBazView" ? new BazView() : null),
                (x, _) => null);

            var vm = new BazViewModel(null);

            var result = RxRouting.ResolveView(vm);

            this.Log().Info(result.GetType().FullName);
            Assert.True(result is BazView);
        }
        public void ResolveExplicitViewType()
        {
            var resolver = new ModernDependencyResolver();

            resolver.InitializeResolver();
            resolver.Register(() => new BazView(), typeof(IBazView));

            using (resolver.WithResolver()) {
                var fixture = new DefaultViewLocator();
                var vm      = new BazViewModel(null);

                var result = fixture.ResolveView(vm);
                this.Log().Info(result.GetType().FullName);
                Assert.True(result is BazView);
            }
        }
Exemple #3
0
        public void ResolveByInterfaceName()
        {
            var resolver = new ModernDependencyResolver();

            resolver.InitializeSplat();
            resolver.InitializeReactiveUI();
            resolver.Register(() => new BazView(), typeof(IBazView));

            using (resolver.WithResolver()) {
                var fixture = new DefaultViewLocator();
                var vm      = new BazViewModel(null);

                var result = fixture.ResolveView(vm);
                this.Log().Info(result.GetType().FullName);
                Assert.IsType <BazView>(result);
            }
        }
 public BazView(BazViewModel viewModel)
 {
     DataContext = viewModel;
     InitializeComponent();
 }