public void WithInnerException_WhenInnerExceptionIsNotNull_ReturnsIntranetExceptionBuilder() { IIntranetExceptionBuilder sut = CreateSut(); IIntranetExceptionBuilder result = sut.WithInnerException(_fixture.Create <Exception>()); Assert.That(result, Is.EqualTo(sut)); }
public void WithMethodBase_WhenMethodBaseIsNull_ThrowsArgumentNullException() { IIntranetExceptionBuilder sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.WithMethodBase(null)); Assert.That(result.ParamName, Is.EqualTo("methodBase")); }
public void WithInnerException_WhenInnerExceptionIsNull_ThrowsArgumentNullException() { IIntranetExceptionBuilder sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.WithInnerException(null)); Assert.That(result.ParamName, Is.EqualTo("innerException")); }
public void WithValidatingType_WhenValidatingTypeIsNotNull_ReturnsIntranetExceptionBuilder() { IIntranetExceptionBuilder sut = CreateSut(); IIntranetExceptionBuilder result = sut.WithValidatingType(typeof(WithValidatingTypeTests)); Assert.That(result, Is.EqualTo(sut)); }
public void WithValidatingType_WhenValidatingTypeIsNull_ThrowsArgumentNullException() { IIntranetExceptionBuilder sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.WithValidatingType(null)); Assert.That(result.ParamName, Is.EqualTo("validatingType")); }
public void WithMethodBase_WhenMethodBaseIsNotNull_ReturnsIntranetExceptionBuilder() { IIntranetExceptionBuilder sut = CreateSut(); IIntranetExceptionBuilder result = sut.WithMethodBase(MethodBase.GetCurrentMethod()); Assert.That(result, Is.EqualTo(sut)); }
public void Build_WhenCalledForIntranetQueryBusExceptionWithoutInnerException_AssertInnerExceptionIsNull() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.NoQueryHandlerSupportingQuery, _fixture.Create <string>(), _fixture.Create <string>()); IntranetExceptionBase result = sut.Build(); Assert.That(result.InnerException, Is.Null); }
public void Build_WhenCalledForIntranetRepositoryExceptionWithoutMethodBase_AssertMethodBaseIsNull() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.RepositoryError, _fixture.Create <string>(), _fixture.Create <string>()); IntranetRepositoryException result = (IntranetRepositoryException)sut.Build(); Assert.That(result.MethodBase, Is.Null); }
public void Build_WhenCalledForIntranetSystemException_ReturnsIntranetSystemException() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.ObjectIsNull, _fixture.Create <string>()); IntranetExceptionBase result = sut.Build(); Assert.That(result, Is.TypeOf <IntranetSystemException>()); }
public void Build_WhenCalledForIntranetRepositoryException_ReturnsIntranetRepositoryException() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.RepositoryError, _fixture.Create <string>(), _fixture.Create <string>()); IntranetExceptionBase result = sut.Build(); Assert.That(result, Is.TypeOf <IntranetRepositoryException>()); }
public void WithValidatingType_WhenValidatingFieldIsNotNullEmptyOrWhiteSpace_ReturnsIntranetExceptionBuilder() { IIntranetExceptionBuilder sut = CreateSut(); IIntranetExceptionBuilder result = sut.WithValidatingField(_fixture.Create <string>()); Assert.That(result, Is.EqualTo(sut)); }
public void Build_WhenCalledForIntranetQueryBusException_ReturnsIntranetQueryBusException() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.NoQueryHandlerSupportingQuery, _fixture.Create <string>(), _fixture.Create <string>()); IntranetExceptionBase result = sut.Build(); Assert.That(result, Is.TypeOf <IntranetQueryBusException>()); }
public void Build_WhenCalledForIntranetValidationExceptionWithoutValidatingField_AssertValidatingFieldIsNull() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.ValueNotGreaterThanZero, _fixture.Create <string>()); IntranetValidationException result = (IntranetValidationException)sut.Build(); Assert.That(result.ValidatingField, Is.Null); }
public void Build_WhenCalledForIntranetRepositoryExceptionWithoutInnerException_AssertInnerExceptionIsNull() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.RepositoryError, _fixture.Create <string>(), _fixture.Create <string>()); IntranetExceptionBase result = sut.Build(); Assert.That(result.InnerException, Is.Null); }
public void Build_WhenCalledForIntranetValidationException_ReturnsIntranetValidationException() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.ValueNotGreaterThanZero, _fixture.Create <string>()); IntranetExceptionBase result = sut.Build(); Assert.That(result, Is.TypeOf <IntranetValidationException>()); }
public void WithValidatingField_WhenValidatingFieldIsWhiteSpace_ThrowsArgumentNullException() { IIntranetExceptionBuilder sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.WithValidatingField(" ")); Assert.That(result.ParamName, Is.EqualTo("validatingField")); }
public void Build_WhenCalledForIntranetQueryBusExceptionWithInnerException_AssertInnerExceptionIsCorrect() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.NoQueryHandlerSupportingQuery, _fixture.Create <string>(), _fixture.Create <string>()); Exception innerException = _fixture.Create <Exception>(); IntranetExceptionBase result = sut.WithInnerException(innerException).Build(); Assert.That(result.InnerException, Is.EqualTo(innerException)); }
public void Build_WhenCalledForIntranetRepositoryExceptionWithMethodBase_AssertMethodBaseIsCorrect() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.RepositoryError, _fixture.Create <string>(), _fixture.Create <string>()); MethodBase methodBase = MethodBase.GetCurrentMethod(); IntranetRepositoryException result = (IntranetRepositoryException)sut.WithMethodBase(methodBase).Build(); Assert.That(result.MethodBase, Is.EqualTo(methodBase)); }
public void Build_WhenCalledForIntranetValidationExceptionWithValidatingField_AssertValidatingFieldIsCorrect() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.ValueNotGreaterThanZero, _fixture.Create <string>()); string validatingField = _fixture.Create <string>(); IntranetValidationException result = (IntranetValidationException)sut.WithValidatingField(validatingField).Build(); Assert.That(result.ValidatingField, Is.EqualTo(validatingField)); }
public void Build_WhenCalledForIntranetRepositoryExceptionWithInnerException_AssertInnerExceptionIsCorrect() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.RepositoryError, _fixture.Create <string>(), _fixture.Create <string>()); Exception innerException = _fixture.Create <Exception>(); IntranetExceptionBase result = sut.WithInnerException(innerException).Build(); Assert.That(result.InnerException, Is.EqualTo(innerException)); }
public void Build_WhenCalledForIntranetValidationExceptionWithInnerException_AssertInnerExceptionIsCorrect() { IIntranetExceptionBuilder sut = CreateSut(ErrorCode.ValueNotGreaterThanZero, _fixture.Create <string>()); Exception innerException = _fixture.Create <Exception>(); IntranetExceptionBase result = sut.WithInnerException(innerException).Build(); Assert.That(result.InnerException, Is.EqualTo(innerException)); }
public void Build_WhenCalledForIntranetValidationException_AssertErrorCodeIsCorrect() { const ErrorCode errorCode = ErrorCode.ValueNotGreaterThanZero; IIntranetExceptionBuilder sut = CreateSut(errorCode, _fixture.Create <string>()); IntranetExceptionBase result = sut.Build(); Assert.That(result.ErrorCode, Is.EqualTo(errorCode)); }
public void Build_WhenCalledForIntranetRepositoryException_AssertErrorCodeIsCorrect() { const ErrorCode errorCode = ErrorCode.RepositoryError; IIntranetExceptionBuilder sut = CreateSut(errorCode, _fixture.Create <string>(), _fixture.Create <string>()); IntranetExceptionBase result = sut.Build(); Assert.That(result.ErrorCode, Is.EqualTo(errorCode)); }
public void Build_WhenCalledForIntranetQueryBusException_AssertErrorCodeIsCorrect() { const ErrorCode errorCode = ErrorCode.NoQueryHandlerSupportingQuery; IIntranetExceptionBuilder sut = CreateSut(errorCode, _fixture.Create <string>(), _fixture.Create <string>()); IntranetExceptionBase result = sut.Build(); Assert.That(result.ErrorCode, Is.EqualTo(errorCode)); }
public void Build_WhenCalledForIntranetSystemException_AssertMessageIsCorrect() { const ErrorCode errorCode = ErrorCode.ObjectIsNull; string commandTypeName = _fixture.Create <string>(); ErrorCodeAttribute errorCodeAttribute = _errorCodeAttributeTestHelper.GetErrorCodeAttribute(errorCode); IIntranetExceptionBuilder sut = CreateSut(errorCode, commandTypeName); IntranetExceptionBase result = sut.Build(); Assert.That(result.Message, Is.EqualTo(string.Format(errorCodeAttribute.Message, commandTypeName))); }
public void Build_WhenCalledForIntranetCommandBusException_AssertMessageIsCorrect() { const ErrorCode errorCode = ErrorCode.NoCommandHandlerSupportingCommandWithoutResultType; string commandTypeName = _fixture.Create <string>(); ErrorCodeAttribute errorCodeAttribute = _errorCodeAttributeTestHelper.GetErrorCodeAttribute(errorCode); IIntranetExceptionBuilder sut = CreateSut(errorCode, commandTypeName); IntranetExceptionBase result = sut.Build(); Assert.That(result.Message, Is.EqualTo(string.Format(errorCodeAttribute.Message, commandTypeName))); }
public void Build_WhenCalledForIntranetValidationException_AssertMessageIsCorrect() { const ErrorCode errorCode = ErrorCode.ValueNotGreaterThanZero; string validatingField = _fixture.Create <string>(); ErrorCodeAttribute errorCodeAttribute = _errorCodeAttributeTestHelper.GetErrorCodeAttribute(errorCode); IIntranetExceptionBuilder sut = CreateSut(errorCode, validatingField); IntranetExceptionBase result = sut.Build(); Assert.That(result.Message, Is.EqualTo(string.Format(errorCodeAttribute.Message, validatingField))); }
public void Build_WhenCalledForIntranetRepositoryException_AssertMessageIsCorrect() { const ErrorCode errorCode = ErrorCode.RepositoryError; string methodName = _fixture.Create <string>(); string error = _fixture.Create <string>(); ErrorCodeAttribute errorCodeAttribute = _errorCodeAttributeTestHelper.GetErrorCodeAttribute(errorCode); IIntranetExceptionBuilder sut = CreateSut(errorCode, methodName, error); IntranetExceptionBase result = sut.Build(); Assert.That(result.Message, Is.EqualTo(string.Format(errorCodeAttribute.Message, methodName, error))); }