From 9d1b98fd9544af060b53aa358fce166ef1f00a83 Mon Sep 17 00:00:00 2001 From: maliming Date: Sun, 20 Dec 2020 10:32:28 +0800 Subject: [PATCH] Add RemovePostFix & RemovePreFix unit tests. --- .../System/StringExtensions_Tests.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs b/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs index 69b02d07c1..3a4a3746eb 100644 --- a/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs @@ -182,7 +182,10 @@ namespace System public void RemovePostFix_Tests() { //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 "MyTestAppService".RemovePostFix("AppService").ShouldBe("MyTest"); @@ -202,6 +205,12 @@ namespace System [Fact] public void RemovePreFix_Tests() { + //null case + (null as string).RemovePreFix("Test").ShouldBeNull(); + + //empty case + string.Empty.RemovePreFix("Test").ShouldBe(string.Empty); + "Home.Index".RemovePreFix("NotMatchedPostfix").ShouldBe("Home.Index"); "Home.About".RemovePreFix("Home.").ShouldBe("About");