public List<NavigationTab> Build()
        {
            var list = new List<NavigationTab>();

            if (customJewelPersistenceBase.DiamondID > 0 )
            {
                diamond = diamondRepository.GetDiamondByID(customJewelPersistenceBase.DiamondID);
            }

            if (customJewelPersistenceBase.SettingID > 0)
            {
                setting = jewelRepository.GetJewelByID(customJewelPersistenceBase.SettingID);
            }

            var diamondTab = BuildDiamondTab();
            list.Add(diamondTab);

            var settingTab = BuildSettingTab();
            list.Add(settingTab);

            var finalTab = BuildFinalTab();

            list.Add(finalTab);

            list = list.Select(ForEachTabEvaluateTheHighlightCSSClass).ToList();

            return list;
        }
示例#2
0
        public void Constructor_ShouldMapTheItemNumberCorrectly()
        {
            //Arrange

            //Act
            var jewel = new Jewel(itemInitializerParameterObject,null,null, null, JewelMediaType.WhiteGold);

            //Assert
            jewel.ItemNumber.Should().Be("0101-15421");
        }
示例#3
0
        public void Constructor_ShouldMapTheTitleCorrectly()
        {
            //Arrange

            //Act
            var jewel = new Jewel(itemInitializerParameterObject, null, null, null, JewelMediaType.WhiteGold);

            //Assert
            jewel.Title.Should().Be("title");
        }
示例#4
0
        public void Constructor_ShouldMapTheIDCorrectly()
        {
            //Arrange

            //Act
            var jewel = new Jewel(itemInitializerParameterObject, null, null, null,JewelMediaType.WhiteGold);

            //Assert
            jewel.ID.Should().Be(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID);
        }
示例#5
0
        public void Constructor_ShouldMapPriceCorrectly()
        {
            //Arrange

            //Act
            var jewel = new Jewel(itemInitializerParameterObject, null, null, null, JewelMediaType.WhiteGold);

            //Assert
            jewel.Price.Should().Be((decimal) 9999.99);
        }
示例#6
0
 private JewelryItemDescriptor ToJewelDescriptor(Jewel jewel)
 {
     return new JewelryItemDescriptor
                {
                    Icon = jewel.Media.IconURLForWebDisplay,
                    ItemUrl = _webHelpers.RouteUrl("JewelryItem", new RouteValueDictionary
                                                                     {
                                                                         {"id",jewel.ID},
                                                                         {"nullableMediaSet",jewel.Media.MediaSet}
                                                                     })
                };
 }
示例#7
0
        public void Constructor_ShouldMapTheCategoriesCorrectly()
        {
            //Arrange

            //Act
            var jewel = new Jewel(itemInitializerParameterObject, null, null, null, JewelMediaType.WhiteGold);

            //Assert
            jewel.JewelCategory.Should().Be("category");
            jewel.JewelCategoryID.Should().Be(2);

            jewel.JewelSubCategory.Should().Be("subcategory");
            jewel.JewelSubCategoryID.Should().Be(7);
        }
        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;
        }
示例#9
0
        protected Jewel JewelClassFactory(v_jewel_items item)
        {
            var initObj = new ItemInitializerParameterObject
                              {
                ID = item.id,
                ItemNumber = item.ITEMNUMBER,
                CategoryID = item.CATEGORY_ID,
                SubCategoryID = item.SUBCATEGORY_ID,
                JewelryCategory = item.jeweltype,
                JewelryCategoryID = item.JEWELTYPE_ID,
                JewelrySubCategory = item.jewelsubtype,
                JewelrySubCategoryID = item.JEWELSUBTYPE_ID,
                SpecialPrice = item.SPECIAL_SELL_PRICE ?? 0,
                DealerPrice = item.DEALER_PRICE ?? 0,
                OnSpecial = item.ONSPECIAL ?? false,
                RegularPrice = item.price ?? 0,
                Metal = item.metal,
                Title = item.jeweltitle,
                OnBargain = item.ONBARGAIN ?? false
            };

            var initJewelExtra = new JewelryExtraInitializerParameterObject
                                     {
                                         CS_Clarity = item.clarity,
                                         CS_ClarityFreeText = item.clarity_freetxt,
                                         CS_Color = item.color,
                                         CS_ColorFreeText = item.color_freetxt,
                                         CS_Count = item.cs_count ?? 0,
                                         CS_Cut = item.cs_cut,
                                         CS_Description = item.cs_desc,
                                         CS_Type = item.cs_type,
                                         HasSideStones = item.has_sidestones ?? false,
                                         SS_Clarity = item.ss_clarity,
                                         SS_ClarityFreeText = "",
                                         SS_Color = item.ss_color,
                                         SS_ColorFreeText = "",
                                         SS_Count = item.ss_count ?? 0,
                                         SS_Cut = item.ss_cut,
                                         SS_Description = item.ss_desc,
                                         SS_Type = item.ss_type,
                                         TotalWeight = Convert.ToDouble(item.total_weight ?? 0),
                                         CS_Weight = Convert.ToDouble(item.cs_weight ?? 0),
                                         SS_Weight = Convert.ToDouble(item.ss_weight ?? 0)
                                     };

            var jewelryExtra = new JewelryExtra(initJewelExtra, initObj);

            initObj.Weight = Convert.ToDouble(item.WEIGHT);

            double tryParseJewelWidth;
            initObj.Width = double.TryParse(item.ITEM_SIZE.Trim(), out tryParseJewelWidth) ? tryParseJewelWidth : 0;

            initObj.Price = DecideWhichPriceToUseAsCurrent(initObj);

            var currrentJewelMediaType = WhichMediaDoesThisJewelHas(item.HAS_YELLOW_GOLD ?? false, item.HAS_WHITE_GOLD ?? false);

            var metal = new Metal(requestedJewelMediaTypeByUser, currrentJewelMediaType,item.metal);

            var mediaFactory = new MediaFactory(initObj.ItemNumber, settingManager);

            mediaFactory.ChangeMediaSet(requestedJewelMediaTypeByUser, currrentJewelMediaType);

            var media = mediaFactory.BuildMedia();

            var jewel = new Jewel(initObj, media, metal, jewelryExtra, currrentJewelMediaType);
            return jewel;
        }
示例#10
0
        protected Jewel JewelClassFactory(v_jewel_items item)
        {
            var initObj = new ItemInitializerParameterObject
            {
                ID                   = item.id,
                ItemNumber           = item.ITEMNUMBER,
                CategoryID           = item.CATEGORY_ID,
                SubCategoryID        = item.SUBCATEGORY_ID,
                JewelryCategory      = item.jeweltype,
                JewelryCategoryID    = item.JEWELTYPE_ID,
                JewelrySubCategory   = item.jewelsubtype,
                JewelrySubCategoryID = item.JEWELSUBTYPE_ID,
                SpecialPrice         = item.SPECIAL_SELL_PRICE ?? 0,
                DealerPrice          = item.DEALER_PRICE ?? 0,
                OnSpecial            = item.ONSPECIAL ?? false,
                RegularPrice         = item.price ?? 0,
                Metal                = item.metal,
                Title                = item.jeweltitle,
                OnBargain            = item.ONBARGAIN ?? false
            };


            var initJewelExtra = new JewelryExtraInitializerParameterObject
            {
                CS_Clarity         = item.clarity,
                CS_ClarityFreeText = item.clarity_freetxt,
                CS_Color           = item.color,
                CS_ColorFreeText   = item.color_freetxt,
                CS_Count           = item.cs_count ?? 0,
                CS_Cut             = item.cs_cut,
                CS_Description     = item.cs_desc,
                CS_Type            = item.cs_type,
                HasSideStones      = item.has_sidestones ?? false,
                SS_Clarity         = item.ss_clarity,
                SS_ClarityFreeText = "",
                SS_Color           = item.ss_color,
                SS_ColorFreeText   = "",
                SS_Count           = item.ss_count ?? 0,
                SS_Cut             = item.ss_cut,
                SS_Description     = item.ss_desc,
                SS_Type            = item.ss_type,
                TotalWeight        = Convert.ToDouble(item.total_weight ?? 0),
                CS_Weight          = Convert.ToDouble(item.cs_weight ?? 0),
                SS_Weight          = Convert.ToDouble(item.ss_weight ?? 0)
            };


            var jewelryExtra = new JewelryExtra(initJewelExtra, initObj);


            initObj.Weight = Convert.ToDouble(item.WEIGHT);

            double tryParseJewelWidth;

            initObj.Width = double.TryParse(item.ITEM_SIZE.Trim(), out tryParseJewelWidth) ? tryParseJewelWidth : 0;

            initObj.Price = DecideWhichPriceToUseAsCurrent(initObj);


            var currrentJewelMediaType = WhichMediaDoesThisJewelHas(item.HAS_YELLOW_GOLD ?? false, item.HAS_WHITE_GOLD ?? false);

            var metal = new Metal(requestedJewelMediaTypeByUser, currrentJewelMediaType, item.metal);

            var mediaFactory = new MediaFactory(initObj.ItemNumber, settingManager);

            mediaFactory.ChangeMediaSet(requestedJewelMediaTypeByUser, currrentJewelMediaType);



            var media = mediaFactory.BuildMedia();



            var jewel = new Jewel(initObj, media, metal, jewelryExtra, currrentJewelMediaType);

            return(jewel);
        }
 public MediaSetsJsonModelBuilder(Jewel jewel, IMediaSetBuilder mediaSetBuilder,IWebHelpers webHelpers)
 {
     this.jewel = jewel;
     this.mediaSetBuilder = mediaSetBuilder;
     this.webHelpers = webHelpers;
 }
示例#12
0
        public void Constructor_ShouldMapTheWeightCorrectly()
        {
            //Arrange

            //Act
            var jewel = new Jewel(itemInitializerParameterObject, null, null, null, JewelMediaType.WhiteGold);

            //Assert
            jewel.Weight.Should().BeInRange(10.50, 10.51);
        }
示例#13
0
        public void GetMedia_ShouldReturnAMediaObject()
        {
            //Arrange
            var manager = new SettingManager();
            var mediaFactory = new MediaFactory(itemInitializerParameterObject.ItemNumber,manager);

            var media = mediaFactory.BuildMedia();
            var metal = new Metal(itemInitializerParameterObject.Metal);
            //Act
            var jewel = new Jewel(itemInitializerParameterObject, media, null, null, JewelMediaType.WhiteGold);

            //Assert

            jewel.Media.Should().NotBeNull();
        }
示例#14
0
        public void Constructor_ShouldRenderJewelTypeAsRingForCategory8()
        {
            //Arrange
            var initObj = fixture.Build<ItemInitializerParameterObject>().With(x => x.JewelryCategoryID, 8).CreateAnonymous();
            //Act
            var jewel = new Jewel(initObj, null, null, null, JewelMediaType.WhiteGold);

            //Assert
            jewel.Type.Should().Be(JewelType.Bracelet);
        }