Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UpdateLinesOnWishlistTest"/> class.
        /// </summary>
        public UpdateLinesOnWishlistTest()
        {
            this.visitorId = Guid.NewGuid();

            this.oldLine = new WishListLine()
            {
                ExternalId = "10",
                Product    = new CartProduct
                {
                    ProductId = "100500",
                    Price     = new Price {
                        Amount = 100
                    }
                },
                Quantity = 12
            };

            this.lineToUpdate = new WishListLine()
            {
                ExternalId = "10",
                Product    = new CartProduct
                {
                    ProductId = "100500",
                    Price     = new Price {
                        Amount = 100
                    }
                },
                Quantity = 2
            };

            this.wishlist = new WishList
            {
                ExternalId = this.visitorId.ToString(),
                Lines      = new ReadOnlyCollection <WishListLine>(new List <WishListLine> {
                    this.oldLine
                })
            };

            this.updatedWishlist = new WishList
            {
                ExternalId = this.visitorId.ToString(),
                Lines      = new ReadOnlyCollection <WishListLine>(new List <WishListLine> {
                    this.lineToUpdate
                })
            };

            this.request = new UpdateWishListLinesRequest(this.wishlist, new[] { this.lineToUpdate });
            this.result  = new UpdateWishListLinesResult();
            this.args    = new ServicePipelineArgs(this.request, this.result);

            this.client = Substitute.For <IWishlistsServiceChannel>();

            var clientFactory = Substitute.For <ServiceClientFactory>();

            clientFactory.CreateClient <IWishlistsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client);

            this.processor = new UpdateLinesOnWishlist {
                ClientFactory = clientFactory
            };
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GetWishlistTest"/> class.
        /// </summary>
        public GetWishlistTest()
        {
            this.visitorId = Guid.NewGuid();
            this.request   = new GetWishListRequest(this.visitorId.ToString(), this.visitorId.ToString(), "NopShop");
            this.result    = new GetWishListResult();
            this.args      = new ServicePipelineArgs(this.request, this.result);

            this.client = Substitute.For <IWishlistsServiceChannel>();

            var clientFactory = Substitute.For <ServiceClientFactory>();

            clientFactory.CreateClient <IWishlistsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client);

            this.processor = new GetWishlist {
                ClientFactory = clientFactory
            };
        }