Example #1
0
        public void GetProductVariants_ReturnVariant()
        {
            var variants     = variantRepository.GetByProductId(skuWithVariants.SKUID).ToList();
            var firstVariant = variants.FirstOrDefault();

            var variantID       = firstVariant.VariantSKU.SKUID;
            var selectedVariant = variantRepository.GetById(variantID);

            CMSAssert.All(
                () => Assert.IsNotNull(selectedVariant, "Variant was not returned"),
                () => Assert.AreEqual(2, selectedVariant.ProductAttributes.Count(), "Variant has wrong option count"),
                () => Assert.IsTrue(selectedVariant.ProductAttributes.Any(o => SIZES.Any(s => s.EqualsCSafe(o.SKUName))), "Variant do not contain correct option")
                );
        }