Exemple #1
0
        public IHttpActionResult UpdateContent([FromBody] ContentItem item)
        {
            var command = new UpdateItemCommand(item);
            var result  = new UpdateItemCommandHandler().Handle(command);

            return(Ok(result));
        }
Exemple #2
0
        public UpdateItemCommandHandlerTests()
        {
            this.currentUserServiceMock = new Mock <ICurrentUserService>();
            this.currentUserServiceMock
            .Setup(x => x.UserId)
            .Returns(DataConstants.SampleUserId);
            this.mediatorMock = new Mock <IMediator>();
            this.mediatorMock
            .Setup(x => x.Send(new UpdatePictureCommand
            {
                ItemId = It.IsAny <Guid>(),
            }, CancellationToken.None))
            .ReturnsAsync(Unit.Value);

            var dateTimeMock = new Mock <IDateTime>();

            dateTimeMock.Setup(x => x.UtcNow).Returns(DateTime.UtcNow);
            dateTimeMock.Setup(x => x.Now).Returns(DateTime.Now);
            this.dateTime = dateTimeMock.Object;

            this.handler =
                new UpdateItemCommandHandler(this.Context, this.currentUserServiceMock.Object,
                                             this.mediatorMock.Object);
        }