Пример #1
0
        public void Should_return_InternalError_if_error_code_is_integer_but_unknown()
        {
            // Given
            var errorService = new ErrorService();
            var code = "-1";

            // When
            var message = errorService.Decode(code);

            // Then
            message.ShouldBe("Unrecognised internal error");
        }
Пример #2
0
        public void Should_return_InternalError_if_error_code_is_not_valid_integer()
        {
            // Given
            var errorService = new ErrorService();
            var code = "<invalid-code>";

            // When
            var message = errorService.Decode(code);

            // Then
            message.ShouldBe("Unrecognised internal error");
        }
Пример #3
0
        public void Should_return_correct_error_message_for_the_requested_error_code()
        {
            // Given
            var errorService = new ErrorService();
            var code = ((int)ErrorCode.UserNameTaken).ToString();

            // When
            var message = errorService.Decode(code);

            // Then
            message.ShouldBe("The UserName has already been taken");
        }