Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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)));
        }
Пример #5
0
        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)));
        }
Пример #6
0
        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)));
        }
Пример #7
0
        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)));
        }