Ejemplo n.º 1
0
        public void ReportForWebDisplay_ShoulReturnTheRightPathToJewelReport()
        {
            //Assign
            ISettingManager manager = MockRepository.GenerateStub <ISettingManager>();

            const string itemNumber = "0101-10001";

            manager.Stub(x => x.GetJewelryBaseWebPath()).Return("/jon-images/jewel/");

            var mediaFactory = new MediaFactory(itemNumber, manager);
            //Act
            var media = mediaFactory.BuildMedia();


            //Assert
            media.ReportURLForWebDisplay.Should().Be("/jon-images/jewel/0101-10001-report-all.jpg");
        }
Ejemplo n.º 2
0
        private JsonMedia BuildAndVerifyMediaByMediaSet(JewelMediaType mediaSet)
        {
            var mediaFactory  = new MediaFactory(itemNumber, settingManager);
            var mediaVerifier = new MediaVerifier(fileSystem);

            mediaFactory.ChangeMediaSet(mediaSet, jewelMediaSets);
            var media = mediaVerifier.Verify(mediaFactory.BuildMedia());

            JsonMedia jsonMedia = null;

            if (media != null)
            {
                jsonMedia = new JsonMedia(media);
            }

            return(jsonMedia);
        }
Ejemplo n.º 3
0
        public void HandURLForWebDisplay_ShoulReturnTheRightPathToPicture()
        {
            //Assign
            ISettingManager manager = MockRepository.GenerateStub <ISettingManager>();

            const string itemNumber = "0101-10001";

            manager.Stub(x => x.GetJewelryBaseWebPath()).Return("/jon-images/jewel/");

            var mediaFactory = new MediaFactory(itemNumber, manager);
            //Act
            Media media = mediaFactory.BuildMedia();

            string iconPath = media.HandURLForWebDisplay;

            //Assert
            Assert.That(iconPath, Is.EqualTo("/jon-images/jewel/0101-10001-hand-wg.jpg"));
        }
Ejemplo n.º 4
0
        public void ReportDiskPathForWebDisplay_ShouldReturnTheRightPath()
        {
            //Assign
            ISettingManager manager = MockRepository.GenerateStub <ISettingManager>();

            const string itemNumber = "0101-10001";

            manager.Stub(x => x.GetJewelryBaseDiskPath()).Return(@"C:\Users\maMLUka\Documents\jewelryonnet\internet-sites\jon-images\jewelry\");

            var mediaFactory = new MediaFactory(itemNumber, manager);
            //Act
            Media media = mediaFactory.BuildMedia();


            //Assert
            media.ReportDiskPathForWebDisplay.Should().Be(
                @"C:\Users\maMLUka\Documents\jewelryonnet\internet-sites\jon-images\jewelry\0101-10001-report-all.jpg");
        }
Ejemplo n.º 5
0
        public void IconDsikPathForWebDisplay_ShouldReturnTheRightPath()
        {
            //Assign
            ISettingManager manager = MockRepository.GenerateStub <ISettingManager>();

            const string itemNumber = "0101-10001";

            manager.Stub(x => x.GetJewelryBaseDiskPath()).Return(@"C:\Users\maMLUka\Documents\jewelryonnet\internet-sites\jon-images\jewelry\");

            var mediaFactory = new MediaFactory(itemNumber, manager);
            //Act
            Media media = mediaFactory.BuildMedia();

            string iconPath = media.IconDiskPathForWebDisplay;

            //Assert
            Assert.That(iconPath, Is.EqualTo(@"C:\Users\maMLUka\Documents\jewelryonnet\internet-sites\jon-images\jewelry\0101-10001-icon-wg.jpg"));
        }
Ejemplo n.º 6
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();



        }
Ejemplo n.º 7
0
        public void IconURLForWebDisplay_ShoulReturnYellowGoldMediaSetWhenAskedForYellowGoldAndGivenYellowGold()
        {
            //Assign
            ISettingManager manager = MockRepository.GenerateStub <ISettingManager>();

            const string itemNumber = "0101-10001";

            manager.Stub(x => x.GetJewelryBaseWebPath()).Return("/jon-images/jewel/");

            var mediaFactory = new MediaFactory(itemNumber, manager);

            mediaFactory.ChangeMediaSet(JewelMediaType.YellowGold, JewelMediaType.YellowGold);
            //Act
            Media media = mediaFactory.BuildMedia();


            //Assert
            media.MediaSet.Should().Be(JewelMediaType.YellowGold);
        }
Ejemplo n.º 8
0
        public void IconURLForWebDisplay_ShoulReturnTheRightPrefixForWhiteGoldIfAllPresent()
        {
            //Assign
            ISettingManager manager = MockRepository.GenerateStub <ISettingManager>();

            const string itemNumber = "0101-10001";

            manager.Stub(x => x.GetJewelryBaseWebPath()).Return("/jon-images/jewel/");

            var mediaFactory = new MediaFactory(itemNumber, manager);

            mediaFactory.ChangeMediaSet(JewelMediaType.WhiteGold, JewelMediaType.All);
            //Act
            Media media = mediaFactory.BuildMedia();

            string iconPath = media.IconURLForWebDisplay;

            //Assert
            iconPath.Should().Contain("wg");
        }
Ejemplo n.º 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
            };

            initJewelExtra.TotalWeight = Convert.ToDouble(item.total_weight ?? 0);
            initJewelExtra.CS_Weight   = Convert.ToDouble(item.cs_weight ?? 0);
            initJewelExtra.SS_Weight   = Convert.ToDouble(item.ss_weight ?? 0);

            var jewelryExtra = new JewelryExtra(initJewelExtra, initObj);


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

            double tryParseJewelWidth;

            if (double.TryParse(item.ITEM_SIZE.Trim(), out tryParseJewelWidth))
            {
                initObj.Width = tryParseJewelWidth;
            }
            else
            {
                initObj.Width = 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);
        }