예제 #1
0
        public async Task Should_Update_President_With_Success()
        {
            // Act
            var response = await _whiteHouseAppService.InsertPresidentAsync(new PresidentDto("1", "New President", new Address("Rua de teste", "123", "APT 12", new ZipCode("12345678"))));

            Assert.False(LocalNotification.HasNotification());

            response.Name.ShouldBe("New President");

            response = await _whiteHouseAppService.UpdatePresidentAsync(response.Id, new PresidentDto(
                                                                            response.Id,
                                                                            "Alter President",
                                                                            response.Address));

            // Assert
            Assert.False(LocalNotification.HasNotification());

            response.Name.ShouldBe("Alter President");
        }
예제 #2
0
        public async Task <IActionResult> Put(string id, [FromBody] PresidentDto president)
        {
            var response = await _whiteHouseAppService.UpdatePresidentAsync(id, president);

            return(CreateResponse <PresidentDto, string>()
                   .FromErrorEnum(PresidentDto.Error.PutPresident)
                   .WithMessage(AppConsts.LocalizationSourceName, PresidentDto.Error.PutPresident)
                   .WithDto(response)
                   .Build());
        }