public async Task WhenPostingChannel_ItShouldIssueCreateChannelCommand() { var data = new NewChannelData(BlogId, ChannelName.Value, Price.Value, IsVisibleToNonSubscribers); var command = new CreateChannelCommand(Requester, ChannelId, BlogId, ChannelName, Price, IsVisibleToNonSubscribers); this.requesterContext.Setup(_ => _.GetRequesterAsync()).ReturnsAsync(Requester); this.guidCreator.Setup(_ => _.CreateSqlSequential()).Returns(ChannelId.Value); this.createChannel.Setup(_ => _.HandleAsync(command)).Returns(Task.FromResult(0)).Verifiable(); var result = await this.target.PostChannelAsync(data); Assert.AreEqual(result, ChannelId); this.createChannel.Verify(); }
private async void FeedCategoryTree_CreateChannel(NewChannelData newChannelData) { var channel = newChannelData.Channel; var parentComponent = newChannelData.ParentTreeComponent; var category = (parentComponent?.Item as Category); if (channel == null || parentComponent == null || category == null) { return; } channel.CategoryId = category.CategoryId; var createdChannel = _channelService.CreateChannel(channel); var treeComponent = new TreeComponent(createdChannel); parentComponent.SubComponents.Add(treeComponent); parentComponent.IsExpanded = true; await _feedUpdater.UpdateFeedAsync(createdChannel.ChannelId); UpdateChannelStats(createdChannel.ChannelId, treeComponent); }