public void Setup_OkState()
        {
            _journeyValidatorMock = new Mock <IJourneyValidator>();
            _journeyValidatorMock.Setup(r => r.ExistsAsync(_id, default)).Returns(Task.FromResult(true));
            _journeyValidatorMock.Setup(r => r.IsVoidedAsync(_id, default)).Returns(Task.FromResult(true));

            _rowVersionValidatorMock = new Mock <IRowVersionValidator>();
            _rowVersionValidatorMock.Setup(r => r.IsValid(_rowVersion)).Returns(true);

            _command = new DeleteJourneyCommand(_id, _rowVersion);

            _dut = new DeleteJourneyCommandValidator(_journeyValidatorMock.Object, _rowVersionValidatorMock.Object);
        }
        public void Validate_ShouldFail_WhenInvalidRowVersion()
        {
            const string invalidRowVersion = "String";

            var command = new DeleteJourneyCommand(_id, invalidRowVersion);

            _rowVersionValidatorMock.Setup(r => r.IsValid(invalidRowVersion)).Returns(false);

            var result = _dut.Validate(command);

            Assert.IsFalse(result.IsValid);
            Assert.AreEqual(1, result.Errors.Count);
            Assert.IsTrue(result.Errors[0].ErrorMessage.StartsWith("Not a valid row version!"));
        }
        public void Setup()
        {
            // Arrange
            _journeyRepositoryMock = new Mock <IJourneyRepository>();
            _journey = new Journey(TestPlant, "J");
            _journeyRepositoryMock
            .Setup(x => x.GetByIdAsync(JourneyId))
            .Returns(Task.FromResult(_journey));
            _command = new DeleteJourneyCommand(JourneyId, _rowVersion);

            _dut = new DeleteJourneyCommandHandler(
                _journeyRepositoryMock.Object,
                UnitOfWorkMock.Object
                );
        }