コード例 #1
0
        public void PresentTabs_ShouldPresentTheDefaultNumberOfItems()
        {
            //Arrange

            var tabKey = "diamond-rings";
            var tabId = "engagement-rings";

            var xmlSource = new XmlSourceFactory();
            var tabsRepository = new TabsRepository(xmlSource);
            var jewelryRepository = new JewelRepository(new SettingManager());
            var fileSystem = new FileSystem();
            var pathBarGenerator = MockRepository.GenerateStub<IPathBarGenerator>();
            var mapper = MockRepository.GenerateStub<IMappingEngine>();

            TabsController controller = new TabsController(tabsRepository,jewelryRepository,fileSystem,xmlSource,pathBarGenerator, mapper);

            var viewModel = MockRepository.GenerateStub<TabsViewModel>();
            viewModel.TabKey = tabKey;
            viewModel.TabId = tabId;

            //Act

            var resultview = controller.SearchTabs(viewModel);

            //Assert

            var model = resultview.Model as TabsViewModel;

            model.JewelryInTabContainersCollection.Count.ShouldBe(10);
        }
コード例 #2
0
        public void PresentTabs_ShouldReturntheRightNumberOfItemsAfterMetalWhiteGoldFilter()
        {
            //Arrange

            var tabKey = "diamond-rings";
            var tabId = "engagement-rings";

            var xmlSource = new XmlSourceFactory();
            var tabsRepository = new TabsRepository(xmlSource);
            var jewelryRepository = new JewelRepository(new SettingManager());
            var fileSystem = new FileSystem();
            var pathBarGenerator = MockRepository.GenerateStub<IPathBarGenerator>();

            var mapper = MockRepository.GenerateStub<IMappingEngine>();

            TabsController controller = new TabsController(tabsRepository, jewelryRepository, fileSystem, xmlSource,pathBarGenerator, mapper);

            var viewModel = new TabsViewModel();
            viewModel.TabKey = tabKey;
            viewModel.TabId = tabId;
            viewModel.MetalFilter = JewelMediaType.WhiteGold;

            //Act

            var resultview = controller.SearchTabs(viewModel);

            //Assert
            var model = resultview.Model as TabsViewModel;

            model.JewelryInTabContainersCollection.Should().HaveCount(9).And.OnlyContain(x=> x.PictureURL.Contains("wg"));
        }
コード例 #3
0
        private TabsController CreateDefaultTabsController()
        {
            var tabsRepository = new TabsRepository(fakeXmlSourceFactory);
            var jewelryRepository = new FakeJewelRepository(new FakeSettingManager());

            var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber();
            var pathBarGenerator = MockRepository.GenerateStub<IPathBarGenerator>();
            var tabsController = new TabsController(tabsRepository, jewelryRepository, fileSystem, fakeXmlSourceFactory,pathBarGenerator, mapper);
            return tabsController;
        }