public Task HandleAsync(InventoryItemRenamed message) { var item = InMemoryDatabase.List.Find(x => x.Id == message.Id); item.Name = message.NewName; return(Task.FromResult(0)); }
public async Task HandleHandlesInventoryItemRenamed() { var repositoryMock = new Mock <IReadModelRepository <InventoryItemDetailsDto, Guid> >(); var hubMock = new Mock <InventoryHub>(); var inventoryItemRenamedEvent = new InventoryItemRenamed(_itemId, _newItemName) { Version = _version, TimeStamp = _timeStamp }; hubMock.Setup(x => x.SendUpdateInventoryItemDetailMessage( _itemId, inventoryItemRenamedEvent)) .Returns(Task.CompletedTask) .Verifiable(); repositoryMock.Setup(x => x.AddOrUpdate(It.Is <InventoryItemDetailsDto> (m => m.Name == _newItemName && m.Version == _version && m.Id == _itemId && m.Timestamp == _timeStamp))) .Returns(Task.CompletedTask) .Verifiable(); repositoryMock.Setup(x => x.GetById(_itemId)) .ReturnsAsync(_searchResponseMock.Object); var target = GetTarget(repositoryMock, hubMock); await target.Handle(inventoryItemRenamedEvent, new CancellationToken(false)); repositoryMock.Verify(); hubMock.Verify(); }
public void Handle(InventoryItemRenamed message) { InventoryItemDetailsDto d = GetDetailsItem(message.Id); d.Name = message.NewName; d.Version = message.Version; }
public Task Handle(InventoryItemRenamed message) { var item = InMemoryDatabase.List.Find(x => x.Id == message.Id); item.Name = message.NewName; return(Task.CompletedTask); }
public void Handle(InventoryItemRenamed @event) { var details = GetDetailsItem(@event.Id); details.Name = @event.NewName; details.Version = @event.Version; }
public void Handle(InventoryItemRenamed @event) { InventoryItemDto d = _readDocumentStore.Documents["InventoryItem"][@event.Id]; d.Name = @event.NewName; d.Version = @event.Version; }
public void Handle(InventoryItemRenamed message) { InventoryItemDetailsDto dto; if (ReadModelFacade.UseSqlDatabase) { using (var datastore = new SqlDatabase()) { if (datastore.Details.TryGetValue(message.Id, out dto)) { dto.Name = message.NewName; dto.Version = message.Version; datastore.InventoryItemDetailsDtoStore.Update(dto); } } } else { if (InMemoryDatabase.Details.TryGetValue(message.Id, out dto)) { dto.Name = message.NewName; dto.Version = message.Version; } } }
public void Handle(InventoryItemRenamed @event) { var inventoryItem = _readDocumentStore.Documents["Inventory"][@event.Id]; inventoryItem.Name = @event.NewName; inventoryItem.Version = @event.Version; }
public Task HandleAsync(InventoryItemRenamed message) { InventoryItemDetailsDto d = GetDetailsItem(message.Id); d.Name = message.NewName; d.Version = message.Version; return(Task.FromResult(0)); }
public Task Handle(InventoryItemRenamed message, CancellationToken token) { var d = GetDetailsItem(message.Id); d.Name = message.NewName; d.Version = message.Version; return(Task.CompletedTask); }
public void Handle(InventoryItemRenamed message) { this.InventoryItemChanged(message); var list = _readModel.GetInventoryItems(); Hub.Clients.All.inventoryItemsListUpdated(list); }
public async Task HandleAsync(InventoryItemRenamed message) { Console.WriteLine("InventoryItemRenamed: " + message.Id); var item = await this.repository.GetByIdAsync(message.Id); item.Version = message.OriginalVersion; item.LastUpdatedAt = message.Timestamp; item.LastUpdatedById = message.OperatorId; item.Name = message.NewName; await this.repository.UpdateAsync(item); await this.repository.UnitOfWork.CommitAsync(); }
/// <summary> /// Handles the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="token">The token.</param> /// <returns>A <see cref="Task" />.</returns> public async Task Handle(InventoryItemRenamed message, CancellationToken token) { var itemQuery = await _database.GetById(message.Id); if (itemQuery.Documents.Any()) { var item = itemQuery.Documents.Single(); item.Name = message.NewName; item.Version = message.Version; item.Timestamp = message.TimeStamp.DateTime; await _database.AddOrUpdate(item); } // notify hub await _hub.SendUpdateInventoryListMessage(); }
public void Handle(InventoryItemRenamed message) { InventoryItemListDto dto; if (ReadModelFacade.UseSqlDatabase) { using (var datastore = new SqlDatabase()) { dto = datastore.List.Single(x => x.Id == message.Id); dto.Name = message.NewName; datastore.InventoryItemListDtoStore.Update(dto); } } else { dto = InMemoryDatabase.List.Single(x => x.Id == message.Id); dto.Name = message.NewName; } }
private void UpdateSummaryItem(InventoryItemRenamed @event) { // Define Query ISingleResultQuery <InventoryItemSummaryQueryStrategy, InventoryItemSummaryEntity> query = QueryFactory.CreateNewSingleResultQuery <InventoryItemSummaryQueryStrategy, InventoryItemSummaryEntity>(); query.QueryStrategy.WithRsn(@event.Rsn); // Retrieve Data, but remember if no items exist, the value is null query = InventoryItemSummaryRepository.Retrieve(query, false); InventoryItemSummaryEntity inventoryItem = query.Result; // As a previous event will have created this instance we should throw an exception if it is not found. if (inventoryItem == null) { throw new NullReferenceException(string.Format("No entity was found by the id '{0}'", @event.Rsn)); } inventoryItem.Name = @event.NewName; // Again, this MUST be an update as commented above. InventoryItemSummaryRepository.Update(inventoryItem); }
partial void OnHandle(InventoryItemRenamed @event) { UpdateDetailedItem(@event); UpdateSummaryItem(@event); }
protected void ApplyChange(InventoryItemRenamed @event) { Name = @event.NewName; OnApplied(@event); }
public void Handle(InventoryItemRenamed message) { _repository.Update(message.AggregateId, Update <InventoryItemListDto> .Set(d => d.Name, message.NewName)); }
public void Handle(InventoryItemRenamed message) { var a = _repository.FindOne <InventoryItemDetailsDto>(message.AggregateId); _repository.Update(message.AggregateId, Update <InventoryItemDetailsDto> .Set(d => d.Name, message.NewName).Set(d => d.Version, message.Version)); }
public void Handle(InventoryItemRenamed message) { var item = InMemoryDatabase.List.Find(x => x.Id == message.Id); item.Name = message.NewName; }
public void Handle(InventoryItemRenamed message) { var item = BullShitDatabase.list.Find(x => x.Id == message.Id); item.Name = message.NewName; }
public void Handle(InventoryItemRenamed @event) { var item = BullshitDatabase.List.Find(x => x.Id == @event.Id); item.Name = @event.NewName; }
public void Apply(InventoryItemRenamed @event) { Name = @event.Name; }
private void Apply(InventoryItemRenamed e) { _name = e.NewName; }
public void Handle(InventoryItemRenamed obj) { List.First(f => f.Id == obj.Id).Name = obj.NewName; }