mirror of https://github.com/abpframework/abp.git
4 changed files with 64 additions and 2 deletions
@ -0,0 +1,3 @@ |
|||
using System.Runtime.CompilerServices; |
|||
|
|||
[assembly: InternalsVisibleTo("Volo.Abp.Auditing.Tests")] |
|||
@ -0,0 +1,24 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Auditing |
|||
{ |
|||
internal static class InternalUtils |
|||
{ |
|||
internal static string AddCounter(string str) |
|||
{ |
|||
if (str.Contains("__")) |
|||
{ |
|||
var splitted = str.Split("__"); |
|||
if (splitted.Length == 2) |
|||
{ |
|||
if (int.TryParse(splitted[1], out var num)) |
|||
{ |
|||
return splitted[0] + "__" + (++num); |
|||
} |
|||
} |
|||
} |
|||
|
|||
return str + "__2"; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using Shouldly; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.Auditing |
|||
{ |
|||
public static class InternalUtils_Tests |
|||
{ |
|||
[Fact] |
|||
public static void AddCounter() |
|||
{ |
|||
InternalUtils.AddCounter("test").ShouldBe("test__2"); |
|||
InternalUtils.AddCounter("test__2").ShouldBe("test__3"); |
|||
InternalUtils.AddCounter("test__a").ShouldBe("test__a__2"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue