コード例 #1
0
        public void ListingController_AddOne_ShouldCallInitAmazonListingFromProductVariant()
        {
            A.CallTo(() => _amazonListingService.GetByProductVariantSku("T1")).Returns(null);

            var result = _listingController.AddOne("T1", 1);

            A.CallTo(() => _prepareForSyncAmazonListingService.InitAmazonListingFromProductVariant(null, "T1", 1)).MustHaveHappened();
        }
コード例 #2
0
        public ActionResult AddOne(string productVariantSku, int amazonListingGroupId)
        {
            if (!String.IsNullOrWhiteSpace(productVariantSku) && amazonListingGroupId > 0)
            {
                var amazonListing = _amazonListingService.GetByProductVariantSku(productVariantSku);
                if (amazonListing == null)
                {
                    amazonListing = _prepareForSyncAmazonListingService.InitAmazonListingFromProductVariant(null,
                                                                                                            productVariantSku, amazonListingGroupId);
                    return(View(amazonListing));
                }

                return(RedirectToAction("Details", new { id = amazonListing.Id }));
            }
            return(RedirectToAction("Index", "ListingGroup"));
        }