Пример #1
0
        public ImageBuilder SetSizeCategory(SizeCategoryEnum category)
        {
            if (category == SizeCategoryEnum.Wrong)
            {
                _pixelWidth  = "";
                _pixelHeight = "";
            }

            return(this);
        }
Пример #2
0
        public void Should_return_largest_image_in_size_category(int img1Height, int img1Width, int img2Height,
                                                                 int img2Width, SizeCategoryEnum category)
        {
            var product = ProductRootBuilder.With()
                          .WithImages(x =>
                                      x.AddImage(i =>
                                                 i.AddImage(y =>
                                                            y.Default().SetHeight(img1Height.ToString()).SetWidth(img1Width.ToString())))
                                      .AddImage(i => i.AddImage(y =>
                                                                y.Default().SetHeight(img2Height.ToString()).SetWidth(img2Width.ToString())))
                                      ).Build();
            var images = ImageSelector.FilterImages(product.Links.SelectedImages);

            images.Should().HaveCount(1);
            images[0].Width.Should().Be(img1Width);
            images[0].Height.Should().Be(img1Height);
            images[0].SizeCategory.Should().Be(category);
        }
Пример #3
0
 public Image(string groupingKey1, string groupingKey2, string contentType, string pixelHeight,
              string orientation, string pixelWidth, string imageUrlHttp, string typeDetail, string fullTitle,
              int contentTypePriority, SizeCategoryEnum sizeCategory, int documentTypeDetailPriority, int height,
              int width)
 {
     GroupingKey1               = groupingKey1;
     GroupingKey2               = groupingKey2;
     ContentType                = contentType;
     PixelHeight                = pixelHeight;
     Orientation                = orientation;
     PixelWidth                 = pixelWidth;
     ImageUrlHttp               = imageUrlHttp;
     TypeDetail                 = typeDetail;
     FullTitle                  = fullTitle;
     ContentTypePriority        = contentTypePriority;
     SizeCategory               = sizeCategory;
     DocumentTypeDetailPriority = documentTypeDetailPriority;
     Height = height;
     Width  = width;
 }
Пример #4
0
        public void Should_return_correct_image_category(string height, string width, SizeCategoryEnum category)
        {
            var ip = new HPEImageParser();

            ip.GetSizeCategory(height, width).Should().Be(category);
        }