public void Validate_WhenCalled_ReturnsValidator() { IDeleteUserIdentityCommand 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>(); IDeleteUserIdentityCommand 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() { IDeleteUserIdentityCommand sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Validate(_validatorMockContext.ValidatorMock.Object, null)); Assert.That(result.ParamName, Is.EqualTo("securityRepository")); }