private JewelDesignController CreateDefaultJewelDesignControllerWithCustomRepository(IJewelRepository jewelRepository)
        {
            var diamondRepository = new FakeDiamondRepository(mapper);
            var formatter         = MockRepository.GenerateStub <IJONFormatter>();

            var webHelpers = MockRepository.GenerateStub <IWebHelpers>();

            formatter.Stub(x => x.ToCaratWeight(Arg <decimal> .Is.Anything)).Return("Not important for this test");
            formatter.Stub(x => x.ToGramWeight(Arg <decimal> .Is.Anything)).Return("Not important for this test");
            formatter.Stub(x => x.ToMilimeter(Arg <decimal> .Is.Anything)).Return("Not important for this test");

            var fileSystem       = FakeFileSystem.MediaFileSystemForItemNumber();
            var xmlSourceFactory = new FakeXmlSourceFactory();
            var tabRepository    = TabsViewModelBuilderTests.CreateStubTabsRepository(TabTestsBase.TabKey);

            var diamondHelpBuilder = new DiamondHelpBuilder(new FakeXmlSourceFactory());

            var pathbarGenerator          = MockRepository.GenerateStub <IPathBarGenerator>();
            var fakeTestimonailRepository = new FakeTestimonialRepository(mapper);


            var controller = new JewelDesignController(diamondRepository, formatter, mapper, jewelRepository, webHelpers,
                                                       xmlSourceFactory, fileSystem, diamondHelpBuilder, tabRepository, pathbarGenerator, fakeTestimonailRepository);

            return(controller);
        }
Пример #2
0
 public DiamondViewModelBuilder(CustomJewelPersistenceInDiamond customJewelPersistence, TabsForJewelDesignNavigationBuilder tabsForJewelDesignNavigationBuilder, IDiamondRepository diamondRepository, DiamondHelpBuilder diamondHelpBuilder, IMappingEngine mapper)
 {
     this.customJewelPersistence = customJewelPersistence;
     this.diamondRepository      = diamondRepository;
     this.diamondHelpBuilder     = diamondHelpBuilder;
     this.tabsForJewelDesignNavigationBuilder = tabsForJewelDesignNavigationBuilder;
     this.mapper = mapper;
 }
        private DiamondViewModelBuilder CreateDefaultDiamondViewModelBuilderWithCustomJewelPersistenceAsAParameter(CustomJewelPersistenceInDiamond customJewel)
        {
            var diamondRepository         = new FakeDiamondRepository(mapper);
            var jewelryRepository         = new FakeJewelRepository(new FakeSettingManager());
            var diamondHelpBuilder        = new DiamondHelpBuilder(new FakeXmlSourceFactory());
            var webHelpers                = MockRepository.GenerateStub <IWebHelpers>();
            var tabsForJewelDesignBuilder = new TabsForJewelDesignNavigationBuilder(customJewel, diamondRepository,
                                                                                    jewelryRepository, webHelpers);

            var builder = new DiamondViewModelBuilder(customJewel, tabsForJewelDesignBuilder, diamondRepository, diamondHelpBuilder, mapper);

            return(builder);
        }
Пример #4
0
        //
        // GET: /JewelDesign/

        public JewelDesignController(IDiamondRepository diamondRepository, IJONFormatter formatter, IMappingEngine mapper, IJewelRepository jewelRepository, IWebHelpers webHelpers, IXmlSourceFactory xmlSourceFactory, IFileSystem fileSystem, DiamondHelpBuilder diamondHelpBuilder, ITabsRepository tabsRepository, IPathBarGenerator pathBarGenerator, ITestimonialRepository testimonialRepository)
        {
            this.diamondRepository     = diamondRepository;
            this.formatter             = formatter;
            this.mapper                = mapper;
            this.jewelRepository       = jewelRepository;
            this.webHelpers            = webHelpers;
            this.xmlSourceFactory      = xmlSourceFactory;
            this.fileSystem            = fileSystem;
            this.diamondHelpBuilder    = diamondHelpBuilder;
            this.tabsRepository        = tabsRepository;
            this.pathBarGenerator      = pathBarGenerator;
            this.testimonialRepository = testimonialRepository;
        }
        public void Build_ReturnTheRightTitleForColorAsAnExmpleForAllOtherAsItsTheSameAlgorithm()
        {
            //Arrange
            var diamond = new Diamond()
            {
                Color   = "H",
                Clarity = "VVS1",
                Cut     = "VG"
            };

            var xmlSourceFactory = new FakeXmlSourceFactory();

            var builder = new DiamondHelpBuilder(xmlSourceFactory);
            //Act
            var list = builder.Build(diamond);

            //Assert
            list["color"].Title.Should().Be("Color");
        }
        public void Build_ShouldReturnThreeHelpItems()
        {
            //Arrange
            var diamond = new Diamond()
            {
                Color   = "H",
                Clarity = "VVS1",
                Cut     = "VG"
            };

            var xmlSourceFactory = new FakeXmlSourceFactory();

            var builder = new DiamondHelpBuilder(xmlSourceFactory);
            //Act
            var list = builder.Build(diamond);

            //Assert
            list.Should().HaveCount(3);
        }
        public void Build_ReturnNAForTheBodyTextWhenTheXmlDoesntContainTheDefinition()
        {
            //Arrange
            var diamond = new Diamond()
            {
                Color   = "P",
                Clarity = "VVS1",
                Cut     = "VG"
            };

            var xmlSourceFactory = new FakeXmlSourceFactory();

            var builder = new DiamondHelpBuilder(xmlSourceFactory);
            //Act
            var list = builder.Build(diamond);

            //Assert
            list["color"].BodyText.Should().Be("N/A");
        }
        public void Build_ReturnTheAllTheValuesForColorAsAnExmpleForAllOtherAsItsTheSameAlgorithm()
        {
            //Arrange
            var diamond = new Diamond()
            {
                Color   = "H",
                Clarity = "VVS1",
                Cut     = "VG"
            };

            var xmlSourceFactory = new FakeXmlSourceFactory();

            var builder = new DiamondHelpBuilder(xmlSourceFactory);
            //Act
            var list = builder.Build(diamond);

            //Assert
            list["color"].HelpValues.Should().Contain("E");
            list["color"].HelpValues.Should().Contain("F");
            list["color"].HelpValues.Should().Contain("G");
            list["color"].HelpValues.Should().Contain("H");
        }