public static QuantityTypeInPacketReadModel ToReadModel(this QuantityTypeInPacket quantityTypeInPacket) { return(new QuantityTypeInPacketReadModel( (int)quantityTypeInPacket, quantityTypeInPacket.ToString(), quantityTypeInPacket.GetAttribute <QuantityLabelAttribute>().QuantityLabel)); }
public ShoppingListItem Create(string name) { // ugly var quantityType = new QuantityType(0, "", 1, "€", "x", 1); var quantityTypeInPacket = new QuantityTypeInPacket(0, "", ""); return(new ShoppingListItem(new ItemId(Guid.NewGuid()), name, true, 1f, quantityType, 1, quantityTypeInPacket, "", "", false, 1)); }
public StoreItem(int id, string name, bool isDeleted, string comment, bool isTemporary, QuantityType quantityType, float quantityInPacket, QuantityTypeInPacket quantityInPacketType, int?itemCategoryId, int?manufacturerId, IEnumerable <StoreItemAvailability> availabilities) { Id = id; Name = name; IsDeleted = isDeleted; Comment = comment; IsTemporary = isTemporary; QuantityType = quantityType; QuantityInPacket = quantityInPacket; QuantityInPacketType = quantityInPacketType; ItemCategoryId = itemCategoryId; ManufacturerId = manufacturerId; Availabilities = availabilities.ToList(); }
public ItemCreation(string name, string comment, QuantityType quantityType, float quantityInPacket, QuantityTypeInPacket quantityTypeInPacket, ItemCategoryId itemCategoryId, ManufacturerId manufacturerId, IEnumerable <IStoreItemAvailability> availabilities) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException($"'{nameof(name)}' cannot be null or whitespace", nameof(name)); } Name = name; Comment = comment; QuantityType = quantityType; QuantityInPacket = quantityInPacket; QuantityTypeInPacket = quantityTypeInPacket; ItemCategoryId = itemCategoryId ?? throw new ArgumentNullException(nameof(itemCategoryId)); ManufacturerId = manufacturerId; this.availabilities = availabilities ?? throw new ArgumentNullException(nameof(availabilities)); }
public IStoreItem Create(ItemId id, string name, bool isDeleted, string comment, bool isTemporary, QuantityType quantityType, float quantityInPacket, QuantityTypeInPacket quantityTypeInPacket, ItemCategoryId itemCategoryId, ManufacturerId manufacturerId, IStoreItem predecessor, IEnumerable <IStoreItemAvailability> availabilities, TemporaryItemId temporaryId) { var item = new StoreItem( id, name, isDeleted, comment, isTemporary, quantityType, quantityInPacket, quantityTypeInPacket, itemCategoryId, manufacturerId, availabilities, temporaryId); item.SetPredecessor(predecessor); return(item); }
public StoreItem(ItemId id, string name, bool isDeleted, string comment, bool isTemporary, QuantityType quantityType, float quantityInPacket, QuantityTypeInPacket quantityTypeInPacket, ItemCategoryId itemCategoryId, ManufacturerId manufacturerId, IEnumerable <IStoreItemAvailability> availabilities, TemporaryItemId temporaryId) { Id = id ?? throw new ArgumentNullException(nameof(id)); Name = name; IsDeleted = isDeleted; Comment = comment; IsTemporary = isTemporary; QuantityType = quantityType; QuantityInPacket = quantityInPacket; QuantityTypeInPacket = quantityTypeInPacket; ItemCategoryId = itemCategoryId; ManufacturerId = manufacturerId; TemporaryId = temporaryId; this.availabilities = availabilities.ToList() ?? throw new ArgumentNullException(nameof(availabilities)); // predecessor must be explicitly set via SetPredecessor(...) due to this AutoFixture bug: // https://github.com/AutoFixture/AutoFixture/issues/1108 Predecessor = null; }