diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml
index e69de29..eb2706c 100644
--- a/.gitea/workflows/test.yml
+++ b/.gitea/workflows/test.yml
@@ -0,0 +1,20 @@
+name: Tests
+
+on: push
+
+jobs:
+ tests:
+ name: Unit Testing1
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ # The repo is on a custom server https://gitea.louisgallet.fr/EPITA-TP-PROG/RiderAndUnitTest.git
+ repository: "EPITA-TP-PROG/B2B-Training"
+ - uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: '7.0.x'
+ - name: "🏗️ Build"
+ run: dotnet build
+ - name: "✅ Test"
+ run: dotnet test
\ No newline at end of file
diff --git a/.idea/.idea.B2BEpita/.idea/indexLayout.xml b/.idea/.idea.B2BEpita/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/.idea/.idea.B2BEpita/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.B2BEpita/.idea/vcs.xml b/.idea/.idea.B2BEpita/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/.idea.B2BEpita/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/B2BEpita.sln b/B2BEpita.sln
index 15ac518..3a313a8 100644
--- a/B2BEpita.sln
+++ b/B2BEpita.sln
@@ -2,6 +2,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iteration", "Iteration\Iteration.csproj", "{57C97023-347E-42B2-B314-9509F78E84B3}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{A838FD78-1D97-4191-91BF-FF439C9FB918}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -12,5 +14,9 @@ Global
{57C97023-347E-42B2-B314-9509F78E84B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{57C97023-347E-42B2-B314-9509F78E84B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{57C97023-347E-42B2-B314-9509F78E84B3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A838FD78-1D97-4191-91BF-FF439C9FB918}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A838FD78-1D97-4191-91BF-FF439C9FB918}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A838FD78-1D97-4191-91BF-FF439C9FB918}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A838FD78-1D97-4191-91BF-FF439C9FB918}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/Iteration/Iterations.cs b/Iteration/Iterations.cs
index 2317316..28708cd 100644
--- a/Iteration/Iterations.cs
+++ b/Iteration/Iterations.cs
@@ -2,5 +2,64 @@ namespace Iteration;
public class Iterations
{
-
+ public static int Reverseint(int n)
+ {
+ int result = 0;
+ if (n > 4)
+ {
+ for (int i = 0; i <= n; i++)
+ {
+ result = result * 10 + n % 10;
+ n /= 10;
+ }
+
+ if (n == 1)
+ {
+ return result * 10 + n;
+ }
+ }
+ else if (n < 4)
+ {
+ for (int i = 0; i >= n; i--)
+ {
+ result = result * 10 + n % 10;
+ n /= 10;
+ }
+
+ if (n == -1)
+ {
+ return result * 10 + n;
+ }
+ }
+ else
+ {
+ return n;
+ }
+
+ return result;
+ }
+
+ public static bool FindSub(string s, string sub)
+ {
+ if (sub == "")
+ {
+ throw new ArgumentException("sub cannot be empty");
+ }
+ string phrase = s;
+ string[] word = s.Split(' ');
+ foreach (var mot in word)
+ {
+ if (mot == sub)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static bool FirstUpper(string s, string sub)
+ {
+ return true;
+ }
}
\ No newline at end of file
diff --git a/Iteration/Program.cs b/Iteration/Program.cs
index e5dff12..7159aa4 100644
--- a/Iteration/Program.cs
+++ b/Iteration/Program.cs
@@ -1,3 +1,3 @@
// See https://aka.ms/new-console-template for more information
-Console.WriteLine("Hello, World!");
\ No newline at end of file
+Console.WriteLine();
\ No newline at end of file
diff --git a/Tests/Interatif/IterationTests.cs b/Tests/Interatif/IterationTests.cs
index 22474fc..4b108db 100644
--- a/Tests/Interatif/IterationTests.cs
+++ b/Tests/Interatif/IterationTests.cs
@@ -2,5 +2,27 @@ namespace Tests.Interatif;
public class IterationTests
{
+ [Theory]
+ [InlineData(123, 321)]
+ [InlineData(1234, 4321)]
+ [InlineData(4, 4)]
+ [InlineData(-4, -4)]
+ [InlineData(24, 42)]
+ [InlineData(-123456, -654321)]
+ public void ReverseintTest(int n, int expected)
+ {
+ int actual = Iteration.Iterations.Reverseint(n);
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData("Clement est le plus beau", "moche", false)]
+ [InlineData("Clement est le plus beau", "beau", true)]
+
+ public void FindSubTest(string s, string sub, bool expected)
+ {
+ bool actual = Iteration.Iterations.FindSub(s, sub);
+ Assert.Equal(expected, actual);
+ }
}
\ No newline at end of file
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index ba8cf18..9b7e8f8 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -22,4 +22,8 @@
+
+
+
+