public async Task <ActionResult> Update(int id, UpdateRaceHistoryCommand raceHistory) { raceHistory.Id = id; await mediator.Send(raceHistory); return(ResponsePut()); }
public void Validate_ShouldContainNotification_WhenIdIsZero() { var notifications = new UpdateRaceHistoryCommand() .Validate(); notifications.Should().ContainEquivalentOf(new Notification("raceHistory.id", "Race history id must be informed")); }
public void Validate_ShouldNotContainNotification_WhenIdIsValid() { var notifications = new UpdateRaceHistoryCommand { Id = 1 } .Validate(); notifications.Where(n => n.Code == "raceHistory.id") .Should().BeEmpty(); }
public async Task Handle_ShouldNotCallNotification_WhenValidCircuit() { var command = new UpdateRaceHistoryCommand { Id = 1, DriverId = 1, CircuitId = 1, Date = DateTime.Now, TimeSpent = 1 }; await instance.Handle(command, new CancellationToken()); raceHistoryRepository.Verify(x => x.Update(It.IsAny <RaceHistory>(), It.IsAny <CancellationToken>())); notificationService.VerifyNoOtherCalls(); }