Example #1
0
        public void Validate_WhenCalled_ReturnsValidator()
        {
            IPaymentTermCommand sut = CreateSut();

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

            Assert.That(result, Is.EqualTo(_validatorMockContext.ValidatorMock.Object));
        }
Example #2
0
        public void Validate_WhenCalled_AssertShouldNotBeNullOrWhiteSpaceWasCalledOnStringValidator()
        {
            string name             = _fixture.Create <string>();
            IPaymentTermCommand sut = CreateSut(name);

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

            _validatorMockContext.StringValidatorMock.Verify(m => m.ShouldNotBeNullOrWhiteSpace(
                                                                 It.Is <string>(value => string.CompareOrdinal(value, name) == 0),
                                                                 It.Is <Type>(type => type == sut.GetType()),
                                                                 It.Is <string>(field => string.CompareOrdinal(field, "Name") == 0)),
                                                             Times.Once());
        }
Example #3
0
        public void Validate_WhenAccountingRepositoryIsNull_ThrowsArgumentNullException()
        {
            IPaymentTermCommand sut = CreateSut();

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

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