public void GetProductCatalogTests() { Product product = new Toy(); product.Name = "Barbie1"; product.Count = 10; product.Price = 9999; product.Unit = "Шт"; productTestCatalog.Add(product); ///Проверка Add Assert.AreEqual(productTestCatalog.GetProducts().Count, 1); }
/// <summary> /// Заполнение полей продукта /// </summary> /// <param name="input">Ввод информации полей</param> /// <returns></returns> private bool Update(string[] args) { if (!initialized) { if (args.Length == 1) { if (!Init(args[0])) { responseBuffer.Append(string.Format(productTypeDoesntExist, args[0])); } } } else { var info = productProperties[propertyIndex]; var isValid = validator.Validate(product, info, args[0]); if (isValid) { info.SetValue(product, validator.GetLastConvertedValue()); if (propertyIndex + 1 < productProperties.Length) { propertyIndex++; } else { productCatalog.Add(product); return(true); } } else { responseBuffer.Append(validator.GetLastErrorMessage()); } } return(false); }