public void Validate_WhenCalled_ReturnsValidator() { IDeleteCountryCommand sut = CreateSut(); IValidator result = sut.Validate(_validatorMockContext.ValidatorMock.Object, _contactRepositoryMock.Object); Assert.That(result, Is.EqualTo(_validatorMockContext.ValidatorMock.Object)); }
public void Validate_WhenCalled_AssertShouldBeDeletableWasCalledOnObjectValidator() { string countryCode = _fixture.Create <string>(); IDeleteCountryCommand sut = CreateSut(countryCode); sut.Validate(_validatorMockContext.ValidatorMock.Object, _contactRepositoryMock.Object); _validatorMockContext.ObjectValidatorMock.Verify(m => m.ShouldBeDeletable( It.Is <string>(value => string.CompareOrdinal(value, countryCode.ToUpper()) == 0), It.IsNotNull <Func <string, Task <ICountry> > >(), It.Is <Type>(value => sut.GetType() == value), It.Is <string>(value => string.Compare(value, "CountryCode", StringComparison.Ordinal) == 0), It.Is <bool>(value => value == false)), Times.Once()); }
public void Validate_WhenContactRepositoryIsNull_ThrowsArgumentNullException() { IDeleteCountryCommand sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Validate(_validatorMockContext.ValidatorMock.Object, null)); Assert.That(result.ParamName, Is.EqualTo("contactRepository")); }