Ejemplo n.º 1
0
        public void Give_ProductSlidingImages_Is_Path_When_ChangeSlidingImagePath_Is_Called_Then_ProductSlidingImages_Is_Changed_To_path()
        {
            var id       = ProductFactory.GetProductId(0);
            var imgInfos = new ImageInfo[] { ProductFactory.GetImageInfo(1, "Path") };
            var expected = ProductFactory.GetProduct(id, slidingImages: imgInfos);

            var actual = ProductFactory.GetProduct(id, slidingImages: new[] { new ImageInfo(0, "path"), });

            actual.ChangeSlidingImagePath(imgInfos);

            actual.SlidingImgPath.First().Should().Be(expected.SlidingImgPath.First());
        }
Ejemplo n.º 2
0
        public void Give_ProductThumbnailImagePath_Is_Path_When_ChangeThumbnailPath_Is_Called_Then_ProductThumbnailImage_Is_Changed_To_path()
        {
            var id       = ProductFactory.GetProductId(0);
            var imgInfo  = ProductFactory.GetImageInfo(1, "Path");
            var expected = ProductFactory.GetProduct(id, thumbnail: imgInfo);

            var actual = ProductFactory.GetProduct(id, thumbnail: new ImageInfo(0, "path"));

            actual.ChangeThumbnailPath(imgInfo);

            actual.ThumbnailPath.Should().Be(expected.ThumbnailPath);
        }
Ejemplo n.º 3
0
        public void When_Product_Is_Creating_And_SlidingImage_Order_Is_Duplicated_Then_Product_Creating_Is_Fail()
        {
            IEnumerable <ImageInfo> slidingImages = new List <ImageInfo>()
            {
                ProductFactory.GetImageInfo(0), ProductFactory.GetImageInfo(0)
            };

            Action act = () => ProductFactory.GetProduct(slidingImages: slidingImages);

            var isContained = act.Should().Throw <AggregateException>().And.InnerExceptions.Select(o => o.GetType())
                              .Contains(typeof(SlidingImageChangingException));

            isContained.Should().BeTrue();
        }
Ejemplo n.º 4
0
        public void When_Product_Apply_ThumbnailChangedEvent_Then_ProductThumbnailImage_Is_Changed()
        {
            ProductId id       = ProductFactory.GetProductId(0);
            var       imgInfo  = ProductFactory.GetImageInfo();
            var       expected = ProductFactory.GetProduct(id, thumbnail: imgInfo);

            var createdEvent          = ProductFactory.GetProductCreatedEvent(id);
            var thumbnailChangedEvent = ProductFactory.GetThumbnailChangedEvent(id, imgInfo);

            var actual = new Product(new[] { createdEvent, thumbnailChangedEvent });

            actual.Should().Be(expected);
            actual.ThumbnailPath.Should().Be(expected.ThumbnailPath);
        }
Ejemplo n.º 5
0
        public void When_Product_Apply_SlidingImageEvent_Then_ProductSlidingImage_Is_Changed()
        {
            ProductId id       = ProductFactory.GetProductId(0);
            var       imgInfo  = ProductFactory.GetImageInfo();
            var       expected = ProductFactory.GetProduct(id, slidingImages: new[] { imgInfo });

            var createdEvent             = ProductFactory.GetProductCreatedEvent(id);
            var slidingImageChangedEvent = ProductFactory.GetSlidingImageChangedEvent(id, new[] { imgInfo });

            var actual = new Product(new[] { createdEvent, slidingImageChangedEvent });

            actual.Should().Be(expected);
            actual.SlidingImgPath.Count().Should().Be(expected.SlidingImgPath.Count());
            actual.SlidingImgPath.First().Should().Be(expected.SlidingImgPath.First());
        }