From 6e8a4ed20b7de32e62e5601c40f8746a5641107b Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:10:10 -0600 Subject: [PATCH 01/10] Fix CI indentation --- .github/workflows/ci.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64db9d16a..e01de4b52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,21 @@ -name: 'Run App , ' +name: 'Run App Kapaba, Defi' on: [push, pull_request] jobs: build-and-test: runs-on: ubuntu-latest + steps: - - run: echo "Hello, World!" + - uses: actions/checkout@v2 + + - name: install dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.x' + + - name: build + run: dotnet build + + - name: run unit tests + run: dotnet test \ No newline at end of file From 176ca906180ac563ed6d04c76b0437d4b2c8af36 Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:14:32 -0600 Subject: [PATCH 02/10] testing --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7400b87d5..bdeca9470 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ # Do not submit a pull request to `kgerot/GithubActions` or `dteske/TraviCI`. Not following this instruction can ruin the lab for others, so pay attention. + I receive around 60 pull requests every semester and have to manually delete each request and action run. Your actions will automatically fail if you open a pull request # Github Actions Lab From 4beab3523c1db4b5d2a110aa5393122d0e0daf41 Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:18:08 -0600 Subject: [PATCH 03/10] Implemented Power method --- Console/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Console/Program.cs b/Console/Program.cs index 56bb86061..c3bcdbcf3 100644 --- a/Console/Program.cs +++ b/Console/Program.cs @@ -84,8 +84,8 @@ public static double Divide(string x, string y) } // Implement this method following a similar pattern as above - public static double Power(string x, string y) + public static double Power(double baseNum, int exponent) { - return 0.0; + return Math.Pow(baseNum, exponent); } } From 21dc34049a0d72b585d78730b1821dea609a84f1 Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:21:44 -0600 Subject: [PATCH 04/10] Fix Power signature --- Console/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Console/Program.cs b/Console/Program.cs index c3bcdbcf3..75a9f9084 100644 --- a/Console/Program.cs +++ b/Console/Program.cs @@ -86,6 +86,8 @@ public static double Divide(string x, string y) // Implement this method following a similar pattern as above public static double Power(double baseNum, int exponent) { - return Math.Pow(baseNum, exponent); + double baseNum = Convert.ToDouble(x); + double exponent = Convert.ToDouble(y); + return Math.Pow(baseNum, exponent); } } From a4458d5995d6a604d7652987f8e52bb023ca94a0 Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:24:00 -0600 Subject: [PATCH 05/10] Correct Power implementation --- Console/Program.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Console/Program.cs b/Console/Program.cs index 75a9f9084..d459ee72d 100644 --- a/Console/Program.cs +++ b/Console/Program.cs @@ -84,10 +84,9 @@ public static double Divide(string x, string y) } // Implement this method following a similar pattern as above + public static double Power(double baseNum, int exponent) { - double baseNum = Convert.ToDouble(x); - double exponent = Convert.ToDouble(y); - return Math.Pow(baseNum, exponent); + return Math.Pow(baseNum, exponent); } } From b25787fa08955f8153e1f655d858f6e84bb86426 Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:25:42 -0600 Subject: [PATCH 06/10] Match Power to delegate --- Console/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Console/Program.cs b/Console/Program.cs index d459ee72d..2eea89268 100644 --- a/Console/Program.cs +++ b/Console/Program.cs @@ -85,8 +85,8 @@ public static double Divide(string x, string y) // Implement this method following a similar pattern as above - public static double Power(double baseNum, int exponent) + public static double Power(string x, string y) { - return Math.Pow(baseNum, exponent); + return Math.Pow(Convert.ToDouble(x), Convert.ToDouble(y)); } } From 55871447ad89ee6e2315e50c9807cdc137916cda Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:31:53 -0600 Subject: [PATCH 07/10] Fix Power null handling --- Console/Program.cs | 3 +++ Tests/DivisionTests.cs | 26 ++++++++++++++++++++++++++ Tests/MultiplicationTests.cs | 27 +++++++++++++++++++++++++++ Tests/PowerTests.cs | 27 +++++++++++++++++++++++++++ Tests/SubtractionTests.cs | 27 +++++++++++++++++++++++++++ 5 files changed, 110 insertions(+) create mode 100644 Tests/DivisionTests.cs create mode 100644 Tests/MultiplicationTests.cs create mode 100644 Tests/PowerTests.cs create mode 100644 Tests/SubtractionTests.cs diff --git a/Console/Program.cs b/Console/Program.cs index 2eea89268..be4c11841 100644 --- a/Console/Program.cs +++ b/Console/Program.cs @@ -87,6 +87,9 @@ public static double Divide(string x, string y) public static double Power(string x, string y) { + if (x == null || y == null) + throw new ArgumentNullException(); + return Math.Pow(Convert.ToDouble(x), Convert.ToDouble(y)); } } diff --git a/Tests/DivisionTests.cs b/Tests/DivisionTests.cs new file mode 100644 index 000000000..eff4883cc --- /dev/null +++ b/Tests/DivisionTests.cs @@ -0,0 +1,26 @@ +namespace GithubActionsLab; + +[TestClass] +public class Division +{ + [TestMethod] + public void Divide_Valid_Kapaba() + { + Assert.AreEqual(2, Program.Divide("4", "2")); + Assert.AreEqual(3, Program.Divide("9", "3")); + } + + [TestMethod] + public void Divide_Invalid_Kapaba() + { + Assert.ThrowsException(() => Program.Divide("a", "2")); + Assert.ThrowsException(() => Program.Divide("2", "b")); + } + + [TestMethod] + public void Divide_Null_Kapaba() + { + Assert.ThrowsException(() => Program.Divide(null, "2")); + Assert.ThrowsException(() => Program.Divide("2", null)); + } +} \ No newline at end of file diff --git a/Tests/MultiplicationTests.cs b/Tests/MultiplicationTests.cs new file mode 100644 index 000000000..257f0fcb5 --- /dev/null +++ b/Tests/MultiplicationTests.cs @@ -0,0 +1,27 @@ +namespace GithubActionsLab; + +[TestClass] +public class Multiplication +{ + [TestMethod] + public void Multiply_Valid_Kapaba() + { + Assert.AreEqual(6, Program.Multiply("2", "3")); + Assert.AreEqual(0, Program.Multiply("0", "5")); + Assert.AreEqual(-6, Program.Multiply("-2", "3")); + } + + [TestMethod] + public void Multiply_Invalid_Kapaba() + { + Assert.ThrowsException(() => Program.Multiply("a", "2")); + Assert.ThrowsException(() => Program.Multiply("2", "b")); + } + + [TestMethod] + public void Multiply_Null_Kapaba() + { + Assert.ThrowsException(() => Program.Multiply(null, "2")); + Assert.ThrowsException(() => Program.Multiply("2", null)); + } +} \ No newline at end of file diff --git a/Tests/PowerTests.cs b/Tests/PowerTests.cs new file mode 100644 index 000000000..98e439e9b --- /dev/null +++ b/Tests/PowerTests.cs @@ -0,0 +1,27 @@ +namespace GithubActionsLab; + +[TestClass] +public class PowerTests +{ + [TestMethod] + public void Power_Valid_Kapaba() + { + Assert.AreEqual(8, Program.Power("2", "3")); + Assert.AreEqual(1, Program.Power("5", "0")); + Assert.AreEqual(16, Program.Power("4", "2")); + } + + [TestMethod] + public void Power_Invalid_Kapaba() + { + Assert.ThrowsException(() => Program.Power("a", "2")); + Assert.ThrowsException(() => Program.Power("2", "b")); + } + + [TestMethod] + public void Power_Null_Kapaba() + { + Assert.ThrowsException(() => Program.Power(null, "2")); + Assert.ThrowsException(() => Program.Power("2", null)); + } +} \ No newline at end of file diff --git a/Tests/SubtractionTests.cs b/Tests/SubtractionTests.cs new file mode 100644 index 000000000..fa703c4a1 --- /dev/null +++ b/Tests/SubtractionTests.cs @@ -0,0 +1,27 @@ +namespace GithubActionsLab; + +[TestClass] +public class Subtraction +{ + [TestMethod] + public void Subtract_Valid_Kapaba() + { + Assert.AreEqual(1, Program.Subtract("3", "2")); + Assert.AreEqual(0, Program.Subtract("5", "5")); + Assert.AreEqual(-2, Program.Subtract("3", "5")); + } + + [TestMethod] + public void Subtract_Invalid_Kapaba() + { + Assert.ThrowsException(() => Program.Subtract("1", "a")); + Assert.ThrowsException(() => Program.Subtract("a", "1")); + } + + [TestMethod] + public void Subtract_Null_Kapaba() + { + Assert.ThrowsException(() => Program.Subtract(null, "1")); + Assert.ThrowsException(() => Program.Subtract("1", null)); + } +} \ No newline at end of file From cd7abb71b3229418130d2861bb2c27429527eb9a Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:38:49 -0600 Subject: [PATCH 08/10] Break test intentionally --- Tests/PowerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/PowerTests.cs b/Tests/PowerTests.cs index 98e439e9b..56319f240 100644 --- a/Tests/PowerTests.cs +++ b/Tests/PowerTests.cs @@ -6,7 +6,7 @@ public class PowerTests [TestMethod] public void Power_Valid_Kapaba() { - Assert.AreEqual(8, Program.Power("2", "3")); + Assert.AreEqual(9, Program.Power("2", "3")); Assert.AreEqual(1, Program.Power("5", "0")); Assert.AreEqual(16, Program.Power("4", "2")); } From 973deeb95cde428e3cc43e45442efc4054c20101 Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:41:11 -0600 Subject: [PATCH 09/10] Fix test --- Tests/PowerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/PowerTests.cs b/Tests/PowerTests.cs index 56319f240..98e439e9b 100644 --- a/Tests/PowerTests.cs +++ b/Tests/PowerTests.cs @@ -6,7 +6,7 @@ public class PowerTests [TestMethod] public void Power_Valid_Kapaba() { - Assert.AreEqual(9, Program.Power("2", "3")); + Assert.AreEqual(8, Program.Power("2", "3")); Assert.AreEqual(1, Program.Power("5", "0")); Assert.AreEqual(16, Program.Power("4", "2")); } From 7c8e5675455f00fea1c4635fb2cd1d8444b15b2e Mon Sep 17 00:00:00 2001 From: Defi <89351972+defimal@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:46:26 -0600 Subject: [PATCH 10/10] green badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bdeca9470..5b703cd77 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Run App](https://github.com/kgerot/GithubActions/actions/workflows/run-app.yaml/badge.svg)](https://github.com/kgerot/GithubActions/actions/workflows/run-app.yaml) +[![Run App Kapaba, Defi](https://github.com/defimal/GithubActions/actions/workflows/ci.yml/badge.svg)](https://github.com/defimal/GithubActions/actions/workflows/ci.yml) # Do not submit a pull request to `kgerot/GithubActions` or `dteske/TraviCI`. Not following this instruction can ruin the lab for others, so pay attention.