public void Validate_WhenCalled_ReturnsValidator() { IUpdateUserIdentityCommand sut = CreateSut(); IValidator result = sut.Validate(_validatorMockContext.ValidatorMock.Object, _securityRepositoryMock.Object); Assert.That(result, Is.EqualTo(_validatorMockContext.ValidatorMock.Object)); }
public void Validate_WhenCalled_AssertShouldBeKnownValueWasCalledOnObjectValidator() { int identifier = _fixture.Create <int>(); IUpdateUserIdentityCommand sut = CreateSut(identifier); sut.Validate(_validatorMockContext.ValidatorMock.Object, _securityRepositoryMock.Object); _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldBeKnownValue( It.Is <int>(value => value == identifier), It.IsNotNull <Func <int, Task <bool> > >(), It.Is <Type>(value => sut.GetType() == value), It.Is <string>(value => string.Compare(value, "Identifier", StringComparison.Ordinal) == 0), It.Is <bool>(value => value == false)), Times.Once()); }
public void Validate_WhenSecurityRepositoryIsNull_ThrowsArgumentNullException() { IUpdateUserIdentityCommand sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Validate(_validatorMockContext.ValidatorMock.Object, null)); Assert.That(result.ParamName, Is.EqualTo("securityRepository")); }