public void Command_Valido_Nao_Deve_Exibir_Erro() { var command = RemoverLivroCommandOverride.RemoverLivroCommand(); command.IsValid(); var validationResult = command.ValidationResult; Assert.True(validationResult.Errors.Count == default(int)); }
public void Command_Com_Id_De_Um_Livro_Nao_Existente_Deve_Exibir_Erro() { livroRepository .Setup(x => x.GetById(It.IsAny <Guid>())) .Returns <LivroStub>(null); var removerLivroCommand = RemoverLivroCommandOverride.RemoverLivroCommand(); CancellationToken cancellationToken = new CancellationToken(); var commandHandler = new LivroCommandHandler(livroRepository.Object, uow.Object, bus.Object, notifications.Object); commandHandler.Handle(removerLivroCommand, cancellationToken); bus.Verify(x => x.RaiseEvent(It.Is <DomainNotification>(m => m.Key == "RemoverLivroCommand")), Times.AtLeastOnce()); }