예제 #1
0
        public void Should_add_uploaded_images_to_product()
        {
            var images = new[]
            {
                new Image(),
                new Image()
            };

            httpFileService.Stub(h => h.GetUploadedImages(
                context.HttpRequestBase, 
                ImageDefinition.ProductImage,
                ImageDefinition.ProductThumbnail)).Return(images.AsEnumerable());

            productOrderableService.Stub(p => p.NextPosition).Return(11);

            var product = new Product();
            context.SetProduct(product);

            contributor.ContributeTo(context);

            product.ProductImages.Count.ShouldEqual(2);
            product.ProductImages[0].Image.ShouldBeTheSameAs(images[0]);
            product.ProductImages[1].Image.ShouldBeTheSameAs(images[1]);
        }