Skip to content

Commit de0cab4

Browse files
committed
github actions and string tests
1 parent 5d81005 commit de0cab4

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ on:
1717
pull_request:
1818
# The branches below must be a subset of the branches above
1919
branches: [ master ]
20-
schedule:
21-
- cron: '19 2 * * 4'
22-
20+
2321
jobs:
2422
analyze:
2523
name: Analyze

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: .NET
1+
name: .NET Build & Test
22

33
on:
44
push:

src/Extensions/StringExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using System.Text;
77
using System.Text.RegularExpressions;
8+
using System.Threading;
89
using Utils.Enums;
910
using static System.IO.Path;
1011

@@ -177,6 +178,8 @@ public static int ToInt32(this string text)
177178

178179
public static double ToDouble(this string text)
179180
{
181+
Thread.CurrentThread.CurrentCulture = new CultureInfo("it-IT");
182+
180183
if (text.IsNullOrEmpty())
181184
return 0;
182185
return double.TryParse(text.Replace('.', ','), out var res) ? res : 0;

tests/Extensions.Tests/StringExtensionsTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,5 +327,15 @@ public void ShouldCapitalizeEachFirstLetter(string str, string expected)
327327
{
328328
Assert.Equal(expected, str.ToTitleCase());
329329
}
330+
331+
[Theory]
332+
[InlineData("", "")]
333+
[InlineData("c", "c")]
334+
[InlineData("ciao", "oaic")]
335+
[InlineData(default, default)]
336+
public void ShouldReverseString(string str, string expected)
337+
{
338+
Assert.Equal(expected, str.Reverse());
339+
}
330340
}
331341
}

0 commit comments

Comments
 (0)