public void Should_return_image_if_only_one_exists() { var product = ProductRootBuilder.With() .WithImages(x => x.AddImage(i => i.AddImage(y => y.Default())) ).Build(); ImageSelector.FilterImages(product.Links.SelectedImages).Should().HaveCount(1); }
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); }
public ToItemTests() { _productRoot = ProductRootBuilder.With() .WithDetail(x => x.Default()) .WithImages(y => y.AddImage(i => i.AddImage(x => x.Default().SetContentType("jpg").SetHeight("100").SetWidth("200") .SetUrl("http://images.com/1234") ) ) ) .WithMarketing(x => x.Default()) .WithHierachy(x => x.AddDefaultNode()) .WithSpecifications(x => x.AddFull().AddSimple()) .WithOptions(x => x.AddDefault()) .Build(); _actual = _productRoot.ToItem(); }
public void Should_not_fail_if_images_is_empty() { var product = ProductRootBuilder.With().Build(); ImageSelector.FilterImages(product.Links.SelectedImages).Should().NotBeNull(); }