public void PlaceView()
        {
            var appWindow = new Window();
            var messageBus = Substitute.For<IMessageBus>();

            var viewModel = Substitute.For<IModalViewModel>();
            var view = new MockModalView();
            view.DataContext = viewModel;

            var viewResult = new ViewResult(view, ViewTargets.DefaultView);

            var viewPlacer = new ModalViewPlacer(appWindow, messageBus);

            viewPlacer.PlaceView(viewResult);

            Assert.IsTrue(view.ShowModalCalled);
            messageBus.Received().Publish<ModalViewClosedMessage>(Arg.Any<ModalViewClosedMessage>());
        }
예제 #2
0
        public void ShowView_AdvancedSearch()
        {
            CreateContainer();

            var title = Guid.NewGuid().ToString();

            var viewModel = Substitute.For<IModalViewModel>();

            var view = new MockModalView();
            view.DataContext = viewModel;
            var viewTarget = MoviesViewTargets.AdvancedSearch;

            var viewResult = new ViewResult(view, viewTarget);

            var window = new Window();
            var tabControl = new TabControl();
            var viewPlacer = new ViewPlacer(window, tabControl);

            viewPlacer.PlaceView(viewResult);

            Assert.IsTrue(view.ShowModalCalled);
            _MessageBus.Received().Publish<ModalViewClosedMessage>(Arg.Any<ModalViewClosedMessage>());
        }