Merge pull request #6705 from PMExtra/patch-1

Fix AbpStringExtensions
pull/6779/head
Halil İbrahim Kalkan 5 years ago committed by GitHub
commit 08bda6cfb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -133,7 +133,7 @@ namespace System
{ {
if (str.IsNullOrEmpty()) if (str.IsNullOrEmpty())
{ {
return null; return str;
} }
if (postFixes.IsNullOrEmpty()) if (postFixes.IsNullOrEmpty())
@ -174,7 +174,7 @@ namespace System
{ {
if (str.IsNullOrEmpty()) if (str.IsNullOrEmpty())
{ {
return null; return str;
} }
if (preFixes.IsNullOrEmpty()) if (preFixes.IsNullOrEmpty())

@ -182,7 +182,10 @@ namespace System
public void RemovePostFix_Tests() public void RemovePostFix_Tests()
{ {
//null case //null case
(null as string).RemovePreFix("Test").ShouldBeNull(); (null as string).RemovePostFix("Test").ShouldBeNull();
//empty case
string.Empty.RemovePostFix("Test").ShouldBe(string.Empty);
//Simple case //Simple case
"MyTestAppService".RemovePostFix("AppService").ShouldBe("MyTest"); "MyTestAppService".RemovePostFix("AppService").ShouldBe("MyTest");
@ -202,7 +205,13 @@ namespace System
[Fact] [Fact]
public void RemovePreFix_Tests() public void RemovePreFix_Tests()
{ {
"Home.Index".RemovePreFix("NotMatchedPostfix").ShouldBe("Home.Index"); //null case
(null as string).RemovePreFix("Test").ShouldBeNull();
//empty case
string.Empty.RemovePreFix("Test").ShouldBe(string.Empty);
"Home.Index".RemovePreFix("NotMatchedPrefix").ShouldBe("Home.Index");
"Home.About".RemovePreFix("Home.").ShouldBe("About"); "Home.About".RemovePreFix("Home.").ShouldBe("About");
//Ignore case //Ignore case

Loading…
Cancel
Save