public async Task UpdateSpeechWhenModelStateIsInvalidReturnBadRequest()
        {
            //Arrange
            var moq = new Mock <IRegisterSpeechUseCase>();
            var moqUpdateSpeechUseCase = new Mock <IUpdateSpeechUseCase>();
            var sut = new SpeechController(moq.Object, moqUpdateSpeechUseCase.Object);

            sut.ModelState.AddModelError("x", "Invalid ModelState");

            //Act
            IActionResult result = await sut.Put(It.IsAny <SpeechForUpdateDto>());

            //Assert
            Assert.IsType <BadRequestObjectResult>(result);
        }
        public async Task UpdateSpeechWhenSpeechIdIsEmptySouldRaisePresentationException()
        {
            //Arrange
            var moq = new Mock <IRegisterSpeechUseCase>();
            var moqUpdateSpeechUseCase = new Mock <IUpdateSpeechUseCase>();
            var sut = new SpeechController(moq.Object, moqUpdateSpeechUseCase.Object);

            var dto = new SpeechForUpdateDto
            {
                Id = Guid.Empty
            };

            //Act
            //Assert
            await Assert.ThrowsAnyAsync <PresentationException>(() => sut.Put(dto));
        }
        public async Task UpdateSpeechWhenModelStateIsValidWithNoErrorsShouldReturnOk()
        {
            //Arrange
            UpdateSpeechCommandMessage updateSpeechCommandMessage = null;
            var moqUpdateSpeechUseCase = new Mock <IUpdateSpeechUseCase>();

            moqUpdateSpeechUseCase.Setup(x =>
                                         x.Handle(It.IsAny <UpdateSpeechCommandMessage>()))
            .Returns(Task.CompletedTask)
            .Callback <UpdateSpeechCommandMessage>(x => updateSpeechCommandMessage = x);

            var speechForUpdateDto = new SpeechForUpdateDto
            {
                Title       = "New is simply dummy text of the printing",
                Description = @"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy
                                text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged",
                Type        = "1",
                Url         = "http://myjpg.jpg",
                Version     = 2,
                Id          = Guid.NewGuid()
            };

            var sut = new SpeechController(It.IsAny <IRegisterSpeechUseCase>(),
                                           moqUpdateSpeechUseCase.Object);

            //Act
            var result = await sut.Put(speechForUpdateDto);

            //Assert
            Assert.IsType <OkResult>(result);
            moqUpdateSpeechUseCase.Verify(x => x.Handle(
                                              It.IsAny <UpdateSpeechCommandMessage>()), Times.Once);
            Assert.Equal(speechForUpdateDto.Id, updateSpeechCommandMessage.SpeechId);
            Assert.Equal(speechForUpdateDto.Title, updateSpeechCommandMessage.Title);
            Assert.Equal(speechForUpdateDto.Description, updateSpeechCommandMessage.Description);
            Assert.Equal(speechForUpdateDto.Type, updateSpeechCommandMessage.Type);
            Assert.Equal(speechForUpdateDto.Url, updateSpeechCommandMessage.Url);
            Assert.Equal(speechForUpdateDto.Version, updateSpeechCommandMessage.OriginalVersion);
        }