public void getInfoList() { TGetInfoList_Return[] allAttributes = productAttributeService.getInfoList(); // test if transfer was successful Assert.Greater(allAttributes.Length, 10, "number of attributes > 10"); // test if the attribute "Color" exists in product type "Jacket" bool existsAttribute = false; foreach (TGetInfoList_Return attributeInfo in allAttributes) { if (attributeInfo.Alias == "Color" && attributeInfo.ProductType == "Jacket") { existsAttribute = true; Assert.IsTrue(attributeInfo.IsVariationAttribute, "attribute 'Color' is a variation attribute"); } } Assert.IsTrue(existsAttribute, "attribute 'Color' exists in class 'Jacket'"); }
public void getInfoList() { TGetInfoList_Return[] allAttributes = productAttributeService.getInfoList(); // test if transfer was successful Assert.Greater(allAttributes.Length, 10, "number of attributes > 10"); // test attributes "Size" and Color in product type "Jacket" foreach (TGetInfoList_Return attributeInfo in allAttributes) { // check product type Jacket if (attributeInfo.ProductTypeAlias == "Jacket") { // check attribute Size if (attributeInfo.Alias == "Size") { Assert.IsTrue(true, "attribute 'Size' of Type 'Jacket' exists"); TPreDefAttribute[] preDefAttributes = attributeInfo.PreDefAttributes; Assert.Greater(preDefAttributes.GetLength(0), 0, "attribute 'Size' of Type 'Jacket' has predefined attributes"); for (int i = 0; i < preDefAttributes.GetLength(0); i++) { if (preDefAttributes[i].Alias == "S") { Assert.IsTrue(true, "attribute 'Size' has predefined attribute 'S'"); Assert.AreEqual(preDefAttributes[i].Value, "S", "attribute 'Size' has right predefined value 'S'"); } if (preDefAttributes[i].Alias == "XXL") { Assert.IsTrue(true, "attribute 'Size' has predefined attribute 'XXL'"); Assert.AreEqual(preDefAttributes[i].Value, "XXL", "attribute 'Size' has right predefined value 'XXL'"); } } } // check attribute Color if (attributeInfo.Alias == "Color") { Assert.IsTrue(true, "attribute 'Color' of Type 'Jacket' exists"); TPreDefAttribute[] preDefAttributes = attributeInfo.PreDefAttributes; Assert.Greater(preDefAttributes.GetLength(0), 0, "attribute 'Color' of Type 'Jacket' has predefined attributes"); for (int i = 0; i < preDefAttributes.GetLength(0); i++) { if (preDefAttributes[i].Alias == "Black") { Assert.IsTrue(true, "attribute 'Color' has predefined attribute 'Black'"); TLocalizedValue[] locValue = preDefAttributes[i].LocalizedValues; for (int j = 0; j < locValue.GetLength(0); j++) { if (locValue[j].LanguageCode == "en") { Assert.AreEqual(locValue[j].Value, "Black", "attribute 'Color' has right predefined value 'Black'"); } if (locValue[j].LanguageCode == "de") { Assert.AreEqual(locValue[j].Value, "Schwarz", "attribute 'Color' has right predefined value 'Schwarz'"); } } } if (preDefAttributes[i].Alias == "ExtremeRed") { Assert.IsTrue(true, "attribute 'Color' has predefined attribute 'ExtremeRed'"); TLocalizedValue[] locValue = preDefAttributes[i].LocalizedValues; for (int j = 0; j < locValue.GetLength(0); j++) { if (locValue[j].LanguageCode == "en") { Assert.AreEqual(locValue[j].Value, "Extreme red", "attribute 'Color' has right predefined value 'Extreme red'"); } if (locValue[j].LanguageCode == "de") { Assert.AreEqual(locValue[j].Value, "Extrem Rot", "attribute 'Color' has right predefined value 'Extrem Rot'"); } } } } } } } }