public ApiResult <NumberTransformResponse> Transform(NumberTransformRequest request) { if (request == null) { throw new ArgumentNullException(); } try { return(new ApiResult <NumberTransformResponse>() { IsSuccess = true, Result = new NumberTransformResponse() { Text = _humanizer.Transform(request.Number), Number = request.Number, Name = request.Name } }); } catch (Exception e) { return(new ApiResult <NumberTransformResponse>() { IsSuccess = false, ErrorMessage = e.Message, Result = null }); } }
public void NumberHumanizerOneDigit(string input, string output) { Assert.AreEqual(output, _humanizer.Transform(input)); }
public void NumberHumanizer_ThrowsException_WhenNumberIsNotValid(string input) { Assert.Catch <ArgumentException>(() => _humanizer.Transform(input)); }