public void GetRandomTestimonails_ShouldReturnThreeTestimonials()
 {
     //Arrange
     var testimonialRepository = new FakeTestimonialRepository(mapper);
     var howMany = 3;
     //Act
     var testamonials = testimonialRepository.GetRandomTestimonails(howMany);
     //Assert
     testamonials.Should().HaveCount(3);
 }
 public void GetRandomTestimonails_ShouldReturnThreeTestimonialsWithNonRepeatingIDS()
 {
     //Arrange
     var testimonialRepository = new FakeTestimonialRepository(mapper);
     var howMany = 3;
     //Act
     var testamonials = testimonialRepository.GetRandomTestimonails(howMany);
     //Assert
     testamonials.Should().OnlyHaveUniqueItems();
 }
        public void GetRandomTestimonails_ShouldReturnThreeTestimonialsWithNonRepeatingIDS()
        {
            //Arrange
            var testimonialRepository = new FakeTestimonialRepository(mapper);
            var howMany = 3;
            //Act
            var testamonials = testimonialRepository.GetRandomTestimonails(howMany);

            //Assert
            testamonials.Should().OnlyHaveUniqueItems();
        }
        public void GetRandomTestimonails_ShouldReturnThreeTestimonials()
        {
            //Arrange
            var testimonialRepository = new FakeTestimonialRepository(mapper);
            var howMany = 3;
            //Act
            var testamonials = testimonialRepository.GetRandomTestimonails(howMany);

            //Assert
            testamonials.Should().HaveCount(3);
        }
        //TODO add two tests for width and weight NA testing



        #region Helpers

        private JewelryItemViewModelBuilder JewelryItemViewModelBuilderFactoryMethod()
        {
            var settingManager            = new FakeSettingManager();
            var fakeRepository            = new FakeJewelRepository(settingManager);
            var fakeTestimonailRepository = new FakeTestimonialRepository(mapper);
            var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber("0101-15421");

            var builder = new JewelryItemViewModelBuilder(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID, fakeRepository, fakeTestimonailRepository, fileSystem, mapper);

            return(builder);
        }
        private JewelryItemViewModelBuilder JewelryItemViewModelBuilderFactoryMethodWithJewelID(int jewelD)
        {
            var settingManager = new FakeSettingManager();
            var fakeRepository = new FakeJewelRepository(settingManager);

            var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber("0101-15421");
            var fakeTestimonailRepository = new FakeTestimonialRepository(mapper);

            var builder = new JewelryItemViewModelBuilder(jewelD, fakeRepository, fakeTestimonailRepository, fileSystem, mapper);

            return(builder);
        }
        private JewelryItemViewModelBuilder CreateJewelItemViewModelBuilderWithJewel(Jewel jewel)
        {
            var fakeRepository = MockRepository.GenerateStub <IJewelRepository>();

            fakeRepository.Stub(x => x.GetJewelByID(Arg <int> .Is.Anything)).Return(jewel);

            var fakeTestimonailRepository = new FakeTestimonialRepository(mapper);
            var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber(jewel.ItemNumber);

            var builder = new JewelryItemViewModelBuilder(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID, fakeRepository, fakeTestimonailRepository, fileSystem, mapper);

            return(builder);
        }
        private JewelryItemController CreateDefaultJewelryItemControllerSetup()
        {
            var fileSystem                = FakeFileSystem.MediaFileSystemForItemNumber(Tests.FAKE_JEWEL_ITEMNUMBER);
            var settingManager            = new FakeSettingManager();
            var jewelryRepository         = new FakeJewelRepository(settingManager);
            var webHelpers                = GetWebHelpers();
            var mediaSetBuilder           = GetMediaSetBuilder();
            var fakeTestimonailRepository = new FakeTestimonialRepository(mapper);
            var bestOffer = MockRepository.GenerateStub <IBestOffer>();

            var wishListPersistence = MockRepository.GenerateStub <IWishListPersistence>();
            var fakeMailer          = MockRepository.GenerateStub <IUserMailer>();
            var pathbarGenerator    = MockRepository.GenerateStub <IPathBarGenerator>();

            var controller = new JewelryItemController(jewelryRepository, mediaSetBuilder, webHelpers, fileSystem, bestOffer, wishListPersistence, fakeTestimonailRepository, fakeMailer, pathbarGenerator, mapper);

            return(controller);
        }
        private JewelryItemController CreateJewelryItemControllerWithCustomerMailer(IUserMailer mailer)
        {
            var fileSystem        = FakeFileSystem.MediaFileSystemForItemNumber("0101-15421");
            var settingManager    = new FakeSettingManager();
            var jewelryRepository = new FakeJewelRepository(settingManager);
            var webHelpers        = GetWebHelpers();
            var mediaSetBuilder   = GetMediaSetBuilder();
            var bestOffer         = MockRepository.GenerateStub <IBestOffer>();

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

            var controller = new JewelryItemController(jewelryRepository, mediaSetBuilder, webHelpers, fileSystem, bestOffer,
                                                       wishListPersistence, fakeTestimonailRepository, mailer, pathbarGenerator, mapper);

            return(controller);
        }
        private JewelryItemViewModelBuilder JewelryItemViewModelBuilderFactoryMethodWithJewelID(int jewelD)
        {
            var settingManager = new FakeSettingManager();
             var fakeRepository = new FakeJewelRepository(settingManager);

             var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber("0101-15421");
             var fakeTestimonailRepository = new FakeTestimonialRepository(mapper);

             var builder = new JewelryItemViewModelBuilder(jewelD, fakeRepository, fakeTestimonailRepository,fileSystem,mapper);
             return builder;
        }
        private JewelryItemViewModelBuilder JewelryItemViewModelBuilderFactoryMethod( Dictionary<string, MockFileData> files )
        {
            var settingManager = new FakeSettingManager();
            var fakeRepository = new FakeJewelRepository(settingManager);

            var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber(files);
            var fakeTestimonailRepository = new FakeTestimonialRepository(mapper);

            var builder = new JewelryItemViewModelBuilder(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID, fakeRepository,fakeTestimonailRepository, fileSystem,mapper);
            return builder;
        }
        private JewelryItemViewModelBuilder CreateJewelItemViewModelBuilderWithJewel(Jewel jewel)
        {
            var fakeRepository = MockRepository.GenerateStub<IJewelRepository>();
            fakeRepository.Stub(x => x.GetJewelByID(Arg<int>.Is.Anything)).Return(jewel);

             var fakeTestimonailRepository = new FakeTestimonialRepository(mapper);
             var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber(jewel.ItemNumber);

             var builder = new JewelryItemViewModelBuilder(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID, fakeRepository, fakeTestimonailRepository, fileSystem, mapper);
             return builder;
        }
        private JewelryItemController CreateJewelryItemControllerWithCustomWishListPersistence(
            IWishListPersistence wishListPersistence)
        {
            var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber("0101-15421");
            var settingManager = new FakeSettingManager();
            var jewelryRepository = new FakeJewelRepository(settingManager);
            var webHelpers = GetWebHelpers();
            var mediaSetBuilder = GetMediaSetBuilder();

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

            var controller = new JewelryItemController(jewelryRepository, mediaSetBuilder, webHelpers, fileSystem,
                                                       bestOffer, wishListPersistence, fakeTestimonailRepository, fakeMailer, pathbarGenerator, mapper);
            return controller;
        }
        private JewelryItemController CreateDefaultJewelryItemControllerSetup()
        {
            var fileSystem = FakeFileSystem.MediaFileSystemForItemNumber(Tests.FAKE_JEWEL_ITEMNUMBER);
            var settingManager = new FakeSettingManager();
            var jewelryRepository = new FakeJewelRepository(settingManager);
            var webHelpers = GetWebHelpers();
            var mediaSetBuilder = GetMediaSetBuilder();
            var fakeTestimonailRepository = new FakeTestimonialRepository(mapper);
            var bestOffer = MockRepository.GenerateStub<IBestOffer>();

            var wishListPersistence = MockRepository.GenerateStub<IWishListPersistence>();
            var fakeMailer = MockRepository.GenerateStub<IUserMailer>();
            var pathbarGenerator = MockRepository.GenerateStub<IPathBarGenerator>();

            var controller = new JewelryItemController(jewelryRepository, mediaSetBuilder, webHelpers, fileSystem, bestOffer, wishListPersistence, fakeTestimonailRepository, fakeMailer, pathbarGenerator, mapper);
            return controller;
        }
        private SettingViewModelBuilder CreateDefaultSettingViewModelBuilderWithCustomModel(CustomJewelPersistenceForSetting customJewelForSetting)
        {
            var settingManager = new FakeSettingManager();
            var jewelryRepository = new FakeJewelRepository(settingManager);
            var diamondRepository = new FakeDiamondRepository(mapper);
            var webHelpers = MockRepository.GenerateStub<IWebHelpers>();

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

            var fakeRepository = new FakeJewelRepository(settingManager);

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

            var fakeTestimonialRepository = new FakeTestimonialRepository(mapper);

            var jewelryItemViewModelBuilder = new JewelryItemViewModelBuilder(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID,
                                                                              fakeRepository, fakeTestimonialRepository,
                                                                              fileSystem, mapper);

            var builder = new SettingViewModelBuilder(customJewelForSetting, tabsForJewelDesignBuilder,
                                                      jewelryItemViewModelBuilder);
            return builder;
        }
        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;
        }