コード例 #1
0
 public ChangeItemQuantityOnShoppingListCommand(ShoppingListId shoppingListId, OfflineTolerantItemId itemId,
                                                float quantity)
 {
     ShoppingListId        = shoppingListId ?? throw new ArgumentNullException(nameof(shoppingListId));
     OfflineTolerantItemId = itemId ?? throw new ArgumentNullException(nameof(itemId));
     Quantity = quantity;
 }
 public ShoppingListReadModel(ShoppingListId id, DateTime?completionDate, ShoppingListStoreReadModel store,
                              IEnumerable <ShoppingListSectionReadModel> sections)
 {
     Id             = id;
     CompletionDate = completionDate;
     Store          = store;
     this.sections  = sections;
 }
 public AddItemToShoppingListCommand(ShoppingListId shoppingListId, OfflineTolerantItemId itemId,
                                     SectionId sectionId, float quantity)
 {
     ShoppingListId = shoppingListId ?? throw new ArgumentNullException(nameof(shoppingListId));
     ItemId         = itemId ?? throw new ArgumentNullException(nameof(itemId));
     SectionId      = sectionId;
     Quantity       = quantity;
 }
 public void SetupFindByAsync(ShoppingListId shoppingListId,
                              IShoppingList returnValue)
 {
     mock
     .Setup(instance => instance.FindByAsync(
                It.Is <ShoppingListId>(id => id == shoppingListId),
                It.IsAny <CancellationToken>()))
     .Returns(Task.FromResult(returnValue));
 }
        public async Task <IShoppingList> FindByAsync(ShoppingListId id, CancellationToken cancellationToken)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            var entity = await GetShoppingListQuery()
                         .FirstOrDefaultAsync(list => list.Id == id.Value);

            cancellationToken.ThrowIfCancellationRequested();

            if (entity == null)
            {
                return(null);
            }

            return(toModelConverter.ToDomain(entity));
        }
 public ShoppingListAlreadyFinishedReason(ShoppingListId id)
 {
     Message = $"Shopping list {id.Value} is already finished.";
 }
コード例 #7
0
 public RemoveItemFromBasketCommand(ShoppingListId shoppingListId, OfflineTolerantItemId itemId)
 {
     ShoppingListId        = shoppingListId ?? throw new ArgumentNullException(nameof(shoppingListId));
     OfflineTolerantItemId = itemId ?? throw new ArgumentNullException(nameof(itemId));
 }
コード例 #8
0
 public SectionAlreadyInShoppingListReason(ShoppingListId shoppingListId, SectionId sectionId)
 {
     Message = $"Section {sectionId} is already part of shopping list {shoppingListId}.";
 }
コード例 #9
0
 public ShoppingListNotFoundReason(ShoppingListId id)
 {
     Message = $"Shopping list {id.Value} not found.";
 }
コード例 #10
0
 public RemoveItemFromShoppingListCommand(ShoppingListId shoppingListId, OfflineTolerantItemId itemId)
 {
     ShoppingListId        = shoppingListId;
     OfflineTolerantItemId = itemId;
 }
 public ItemNotOnShoppingListReason(ShoppingListId shoppingListId, ItemId shoppingListItemId)
 {
     Message = $"Item {shoppingListItemId} is not on shopping list {shoppingListId.Value}.";
 }
コード例 #12
0
 public void SetupId(ShoppingListId returnValue)
 {
     Setup(i => i.Id)
     .Returns(returnValue);
 }
 private async Task <Entities.ShoppingList> FindEntityByIdAsync(ShoppingListId id)
 {
     return(await GetShoppingListQuery()
            .FirstOrDefaultAsync(list => list.Id == id.Value));
 }
コード例 #14
0
 public ItemAlreadyOnShoppingListReason(ItemId itemId, ShoppingListId listId)
 {
     Message = $"Item {itemId} already exists on shopping list {listId.Value}";
 }
コード例 #15
0
 public IShoppingList Create(ShoppingListId id, StoreId storeId, DateTime?completionDate,
                             IEnumerable <IShoppingListSection> sections)
 {
     return(new ShoppingList(id, storeId, completionDate, sections));
 }
 public FinishShoppingListCommand(ShoppingListId shoppingListId, DateTime completionDate)
 {
     ShoppingListId = shoppingListId ?? throw new ArgumentNullException(nameof(shoppingListId));
     CompletionDate = completionDate;
 }