コード例 #1
0
        public void ChooseSetting_ShouldRenderTheViewWithTheRightModel()
        {
            //Arrange
            var controller = CreateDefaultJewelDesignController();

            var chooseSettingViewModel = new ChooseSettingViewModel();
            chooseSettingViewModel.TabKey = TabTestsBase.TabKey;
            chooseSettingViewModel.TabId = TabTestsBase.TabID1;

            //Act
            var result = controller.ChooseSetting(chooseSettingViewModel);
            //Assert
            result.AssertViewRendered().WithViewData<ChooseSettingViewModel>();
        }
コード例 #2
0
        public void ChooseSetting_ShouldRedirectToChooseSetting()
        {
            //Arrange
            var controller = CreateDefaultJewelDesignController();

            var chooseSettingViewModel = new ChooseSettingViewModel();
            chooseSettingViewModel.TabKey = TabTestsBase.TabKey;
            chooseSettingViewModel.TabId = TabTestsBase.TabID1;

            //Act
            var result = controller.ChooseSettingPost(chooseSettingViewModel);
            //Assert
            result.AssertActionRedirect();
        }
コード例 #3
0
        public ActionResult ChooseSetting(ChooseSettingViewModel chooseSettingViewModel )
        {
            var tabsource = xmlSourceFactory.TabSource();

            var tabsViewModelBuilder = new TabsViewModelBuilder(chooseSettingViewModel, tabsource, tabsRepository, jewelRepository, fileSystem);

            var tabsForJewelNavigation = new TabsForJewelDesignNavigationBuilder(chooseSettingViewModel, diamondRepository,
                                                                    jewelRepository, webHelpers);

            tabsForJewelNavigation.WhichTabToHighLight(NagivationTabType.ChooseSetting);

            var builder = new ChooseSettingViewModelBuilder(chooseSettingViewModel, tabsViewModelBuilder, tabsForJewelNavigation);

            var viewModel = builder.Build();

            viewModel.PathBarItems = pathBarGenerator.GenerateUsing<TabsPathBarResolver, ITabsViewModel>(viewModel);

            return View(viewModel);
        }
コード例 #4
0
        public ActionResult ChooseSettingPost(ChooseSettingViewModel chooseSettingViewModel)
        {
            return RedirectToRoute("ChooseSetting", new RouteValueDictionary()
                                                        {
                                                            {"DiamondID", chooseSettingViewModel.DiamondID},
                                                            {"SettingID", chooseSettingViewModel.SettingID},
                                                            {"controller", "JewelDesign"},
                                                            {"action", "ChooseSetting"},
                                                            {"tabid", chooseSettingViewModel.TabId},
                                                            {"page", 1},
                                                            {"MetalFilter", chooseSettingViewModel.MetalFilter},
                                                            {"OrderByPrice", chooseSettingViewModel.OrderByPrice},
                                                            {"itemsperpage", chooseSettingViewModel.ItemsPerPage}

                                                        });
        }
コード例 #5
0
        private ChooseSettingViewModelBuilder CreateDefaultChooseSettingViewModelBuilderWithChooseSettingModelAsAParameter(ChooseSettingViewModel chooseSettingViewModel)
        {
            var settingManager = new FakeSettingManager();
            var tabsRepository = TabsViewModelBuilderTests.CreateStubTabsRepository(JEWEL_DESIGN_TABKEY);
            var jewelryRepository = new FakeJewelRepository(settingManager);

            var fakeTabXmlFactory = new FakeTabXmlFactory();
            var xmldoc_jeweldesign = fakeTabXmlFactory.JewelDesign3Tabs(JEWEL_DESIGN_TABKEY);

            var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber("0101-15421");

            TabsViewModelBuilder tabsViewModelBuilder = new TabsViewModelBuilder(chooseSettingViewModel,
                                                                                 xmldoc_jeweldesign,
                                                                                 tabsRepository, jewelryRepository, fileSystem);

            var diamondRepository = new FakeDiamondRepository(mapper);
            var webHelpers = MockRepository.GenerateStub<IWebHelpers>();

            var tabsForJewelDesignBuilder = new TabsForJewelDesignNavigationBuilder(chooseSettingViewModel,
                                                                                    diamondRepository, jewelryRepository,
                                                                                    webHelpers);

            var builder = new ChooseSettingViewModelBuilder(chooseSettingViewModel, tabsViewModelBuilder, tabsForJewelDesignBuilder);
            return builder;
        }
コード例 #6
0
 public ChooseSettingViewModelBuilder(ChooseSettingViewModel chooseSettingViewModel, TabsViewModelBuilder tabsViewModelBuilder, TabsForJewelDesignNavigationBuilder tabsForJewelDesignBuilder)
 {
     this.chooseSettingViewModel = chooseSettingViewModel;
     this.tabsViewModelBuilder = tabsViewModelBuilder;
     this.tabsForJewelDesignBuilder = tabsForJewelDesignBuilder;
 }