public void Validate_WhenCalled_ReturnsValidator() { IGetPostingLineCollectionQuery sut = CreateSut(); IValidator result = sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object); Assert.That(result, Is.EqualTo(_validatorMockContext.ValidatorMock.Object)); }
public void Validate_WhenCalled_AssertShouldBeBetweenWasCalledOnIntegerValidator() { int numberOfPostingLines = _fixture.Create <int>(); IGetPostingLineCollectionQuery sut = CreateSut(numberOfPostingLines); sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.IntegerValidatorMock.Verify(m => m.ShouldBeBetween( It.Is <int>(value => value == numberOfPostingLines), It.Is <int>(minValue => minValue == 1), It.Is <int>(maxValue => maxValue == 512), It.Is <Type>(type => type == sut.GetType()), It.Is <string>(field => string.CompareOrdinal(field, "NumberOfPostingLines") == 0)), Times.Once()); }
public void Validate_WhenAccountingRepositoryIsNull_ThrowsArgumentNullException() { IGetPostingLineCollectionQuery sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Validate(_validatorMockContext.ValidatorMock.Object, null)); // ReSharper disable PossibleNullReferenceException Assert.That(result.ParamName, Is.EqualTo("accountingRepository")); // ReSharper restore PossibleNullReferenceException }