public async Task WhiteHouse_Service_Insert_Valid_Presidents() { //Arrange LocalEventBus.Register <PresidentCreatedEvent>( eventData => { var presidentEvent = eventData.President; Assert.True(presidentEvent.Id == "1" || presidentEvent.Id == "2"); }); var builder = new PresidentBuilder(LocalNotification) .WithId("1") .WithName("George Washington") .WithAddress(new Address("Rua de teste", "123", "APT 12", new ZipCode("12345678"))); // Act await _whiteHouseService.InsertPresidentAsync(builder); // Assert Assert.False(LocalNotification.HasNotification()); }
public async Task <PresidentDto> InsertPresidentAsync(PresidentDto dto) { if (dto == null) { RaiseNotification(nameof(dto)); } if (Notification.HasNotification()) { return(new PresidentDto()); } var builder = new PresidentBuilder(Notification) .WithId(dto.Id) .WithName(dto.Name) .WithAddress(dto.Address); dto.Id = await _whiteHouserService.InsertPresidentAsync(builder); return(dto); }