コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: z3ut/rss-reader
        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);
        }