public void ShouldGetExpectedStringWhenToString() { OrderInfo order = new OrderItem("Name"); order.Add("Age", OrderType.Desc); Assert.AreEqual("+Name,-Age", order.ToString()); }
private static List <OrderItem> OrderItems(SaveOrderResource model) { return(model.OrderItems.Select(item => OrderItem.Add(item.ProductId, item.SparePartId, item.Quantity, item.CompanyId, item.ReturnDefective, item.LeftInBag)) .ToList()); }
public void DrawProperies(PropertyData data) { var buttons = Utilities.FindByAttribute <ButtonAttribute, MethodInfo>(data.Value); DrawMethodButtons(data, buttons, ButtonAttribute.AlignTypes.Top); Dictionary <OrderItem, string> itemList = new Dictionary <OrderItem, string>(); OrderItem items = new OrderItem("", 0); Dictionary <string, OrderItem> attrList = new Dictionary <string, OrderItem>(); var iterator = data.Property.Copy(); int index = 0; for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false) { if (string.IsNullOrEmpty(data.Property.propertyPath) || iterator.propertyPath.IndexOf(data.Property.propertyPath, StringComparison.Ordinal) == 0) { PropertyData itemData = new PropertyData(iterator.Copy(), data); if ("m_Script" == iterator.propertyPath) { EditorGUI.BeginDisabledGroup(true); Editor.Property.Draw(itemData); EditorGUI.EndDisabledGroup(); } else { string path = ""; foreach (var attribute in itemData.Attributes.Select(e => e as GroupAttribute)) { if (attribute != null) { if (!attrList.ContainsKey(attribute.Name)) { attrList.Add(attribute.Name, new OrderItem(attribute, index)); } path = path.Length < attribute.Name.Length ? attribute.Name : path; } } itemList.Add(new OrderItem(itemData, index), path); //var groupAttr = itemData.Attributes.FirstOrDefault(e => e is GroupAttribute) as GroupAttribute; //items.Add(groupAttr != null ? groupAttr.Name, , new OrderItem(itemData, index)); //AddItem(items, new OrderItem(itemData, index)); index++; } } } foreach (var pair in attrList) { items.Add(pair.Value, pair.Key); } foreach (var pair in itemList) { items.Add(pair.Key, pair.Value); } items.Sort(); items.Draw(e => Editor.Property.Draw(e.Data)); DrawMethodButtons(data, buttons, ButtonAttribute.AlignTypes.Bottom); }
public void AddOrderItem(Product product, int quantity) { OrderId newItem = new OrderId(product, quantity); OrderItem.Add(newItem); }