//mapping tests after the regular tab builder


        private ChooseSettingViewModelBuilder CreateDefaultChooseSettingViewModelBuilder()
        {
            var chooseSettingViewModel = new ChooseSettingViewModel();

            chooseSettingViewModel.TabId  = JEWEL_DESIGN_TABID_01;
            chooseSettingViewModel.TabKey = JEWEL_DESIGN_TABKEY;

            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);
        }
Пример #2
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 }
     }));
 }
        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>();
        }
        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();
        }
Пример #5
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));
        }
Пример #6
0
 public ChooseSettingViewModelBuilder(ChooseSettingViewModel chooseSettingViewModel, TabsViewModelBuilder tabsViewModelBuilder, TabsForJewelDesignNavigationBuilder tabsForJewelDesignBuilder)
 {
     this.chooseSettingViewModel    = chooseSettingViewModel;
     this.tabsViewModelBuilder      = tabsViewModelBuilder;
     this.tabsForJewelDesignBuilder = tabsForJewelDesignBuilder;
 }