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(); }
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")); }