public void Validate_WhenCalled_ReturnsValidator() { ILetterHeadIdentificationQuery sut = CreateSut(); IValidator result = sut.Validate(_validatorMockContext.ValidatorMock.Object, _commonRepositoryMock.Object); Assert.That(result, Is.EqualTo(_validatorMockContext.ValidatorMock.Object)); }
public void Validate_WhenCalled_AssertShouldBeBetweenWasCalledOnIntegerValidator() { int number = _fixture.Create <int>(); ILetterHeadIdentificationQuery sut = CreateSut(number); sut.Validate(_validatorMockContext.ValidatorMock.Object, _commonRepositoryMock.Object); _validatorMockContext.IntegerValidatorMock.Verify(m => m.ShouldBeBetween( It.Is <int>(value => value == number), It.Is <int>(minValue => minValue == 1), It.Is <int>(maxValue => maxValue == 99), It.Is <Type>(type => type == sut.GetType()), It.Is <string>(field => string.Compare(field, "Number", false) == 0)), Times.Once()); }
public void Validate_WhenCommonRepositoryIsNull_ThrowsArgumentNullException() { ILetterHeadIdentificationQuery sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Validate(_validatorMockContext.ValidatorMock.Object, null)); Assert.That(result.ParamName, Is.EqualTo("commonRepository")); }