public void Validate_ShouldContainNotification_WhenIdIsZero() { var notifications = new UpdateCircuitCommand() .Validate(); notifications.Should().ContainEquivalentOf(new Notification("circuit.id", "Circuit id must be informed")); }
public async Task <ActionResult> Update(int id, UpdateCircuitCommand driver) { driver.Id = id; await mediator.Send(driver); return(ResponsePut()); }
public void Validate_ShouldNotContainNotification_WhenIdIsValid() { var notifications = new UpdateCircuitCommand { Id = 1 } .Validate(); notifications.Where(n => n.Code == "circuit.id") .Should().BeEmpty(); }
public async Task Handle_ShouldNotCallNotification_WhenValidCircuit() { var command = new UpdateCircuitCommand { Id = 1, Description = "Description" }; await instance.Handle(command, new CancellationToken()); circuitRepository.Verify(x => x.Update(It.IsAny <Circuit>(), It.IsAny <CancellationToken>())); notificationService.VerifyNoOtherCalls(); }