From 80414699a0e009184c5591259e590699023fadcf Mon Sep 17 00:00:00 2001 From: oenning Date: Thu, 23 Oct 2014 22:34:28 -0200 Subject: [PATCH] minor bug when remote value is empty string --- src/base/Properties/AssemblyInfo.cs | 4 ++-- src/base/RfcValueMapper.cs | 3 +++ tests/Mapper/AbapValueMapperFromRemoteTestData.cs | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/base/Properties/AssemblyInfo.cs b/src/base/Properties/AssemblyInfo.cs index 0899b10..441ee2f 100644 --- a/src/base/Properties/AssemblyInfo.cs +++ b/src/base/Properties/AssemblyInfo.cs @@ -27,5 +27,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.0")] -[assembly: AssemblyFileVersion("2.0.0")] +[assembly: AssemblyVersion("2.0.1")] +[assembly: AssemblyFileVersion("2.0.1")] diff --git a/src/base/RfcValueMapper.cs b/src/base/RfcValueMapper.cs index ac4d595..19e8fa6 100644 --- a/src/base/RfcValueMapper.cs +++ b/src/base/RfcValueMapper.cs @@ -52,6 +52,9 @@ public virtual object FromRemoteValue(Type type, object value) if (type.IsEnum) return this.ConvertToEnum(type, value); + if (type.Equals(typeof(string))) + return value == null ? "" : value.ToString(); + if (value == null || value.ToString().Equals("")) { if (type.IsNullable()) diff --git a/tests/Mapper/AbapValueMapperFromRemoteTestData.cs b/tests/Mapper/AbapValueMapperFromRemoteTestData.cs index 5408546..322ef69 100644 --- a/tests/Mapper/AbapValueMapperFromRemoteTestData.cs +++ b/tests/Mapper/AbapValueMapperFromRemoteTestData.cs @@ -51,6 +51,12 @@ public AbapValueMapperFromRemoteTestData() new object[] { true, typeof(Boolean), "X" }, new object[] { false, typeof(Boolean), " " }, new object[] { false, typeof(Boolean), "" }, + + new object[] { "", typeof(string), "" }, + new object[] { "", typeof(string), null }, + new object[] { " ", typeof(string), " " }, + new object[] { "abc", typeof(string), "abc" }, + new object[] { "A@b2", typeof(string), "A@b2" }, new object[] { "My Name is", typeof(String), "My Name is" }, new object[] { 1, typeof(int), "0001" },