public void Validate_WhenCalled_ReturnsValidator() { IDeleteAccountGroupCommand sut = CreateSut(); IValidator result = sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object); Assert.That(result, Is.EqualTo(_validatorMockContext.ValidatorMock.Object)); }
public void Validate_WhenCalled_AssertShouldBeDeletableWasCalledOnObjectValidator() { int number = _fixture.Create <int>(); IDeleteAccountGroupCommand sut = CreateSut(number); sut.Validate(_validatorMockContext.ValidatorMock.Object, _accountingRepositoryMock.Object); _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldBeDeletable( It.Is <int>(value => value == number), It.IsNotNull <Func <int, Task <IAccountGroup> > >(), It.Is <Type>(type => type == sut.GetType()), It.Is <string>(field => string.Compare(field, "Number", false) == 0), It.Is <bool>(allowNull => allowNull == false)), Times.Once()); }
public void Validate_WhenAccountingRepositoryIsNull_ThrowsArgumentNullException() { IDeleteAccountGroupCommand sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Validate(_validatorMockContext.ValidatorMock.Object, null)); Assert.That(result.ParamName, Is.EqualTo("accountingRepository")); }