Пример #1
0
        public void CreateViewModel_CreatesAndInitializesViewModelCorrectly(
            [CombinatorialValues(null, "")] string title,
            [CombinatorialValues(0, 1)] int key)
        {
            var container = Substitute.For <IContainer>();
            var frameNavigationService = Substitute.For <IFrameNavigationService>();

            container.Resolve <IFrameNavigationService>().ReturnsForAnyArgs(frameNavigationService);

            var tabItem   = new TabItem <ViewModelStub, int>(title, key, container);
            var viewModel = tabItem.CreateViewModel();

            Assert.NotNull(viewModel);
            Assert.IsAssignableFrom <TabViewModel <ViewModelStub, int> >(viewModel);
            Assert.Equal(frameNavigationService, viewModel.FrameNavigationService);
            Assert.Equal(title, viewModel.Title);
            Assert.Equal(key, viewModel.Key);
        }