public void Validate_WhenCalled_ReturnsValidator()
        {
            IDeleteAccountCommand sut = CreateSut();

            IValidator result = sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object, _commonRepositoryMock.Object);

            Assert.That(result, Is.SameAs(_validatorMockContext.ValidatorMock.Object));
        }
        public void Validate_WhenCalled_AssertShouldBeDeletableWasCalledOnObjectValidatorWithAccountNumber()
        {
            string accountNumber      = _fixture.Create <string>().ToUpper();
            IDeleteAccountCommand sut = CreateSut(accountNumber);

            sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object, _commonRepositoryMock.Object);

            _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldBeDeletable(
                                                                 It.Is <string>(value => string.CompareOrdinal(value, accountNumber) == 0),
                                                                 It.IsNotNull <Func <string, Task <IAccount> > >(),
                                                                 It.Is <Type>(type => type == sut.GetType()),
                                                                 It.Is <string>(field => string.CompareOrdinal(field, "AccountNumber") == 0),
                                                                 It.Is <bool>(allowNull => allowNull == false)),
                                                             Times.Once);
        }
        public void Validate_WhenCommonRepositoryIsNull_ThrowsArgumentNullException()
        {
            IDeleteAccountCommand sut = CreateSut();

            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object, null));

            Assert.That(result.ParamName, Is.EqualTo("commonRepository"));
        }