From ac8b37ab048dc6ac35c01d21ef3364031ae61f0f Mon Sep 17 00:00:00 2001 From: Yohannes Date: Wed, 25 Mar 2026 21:18:45 -0500 Subject: [PATCH 1/7] Set up GitHub Actions workflow --- .github/workflows/ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64db9d16..454a18bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: 'Run App , ' +name: 'Run App YourLastName, YourFirstName' on: [push, pull_request] @@ -6,4 +6,12 @@ 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 3b683d7c7f80ca0a8f955ad6b46976e96222a5fd Mon Sep 17 00:00:00 2001 From: Yohannes Date: Wed, 25 Mar 2026 21:24:00 -0500 Subject: [PATCH 2/7] Implement Power method --- Console/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Console/Program.cs b/Console/Program.cs index 56bb8606..e443b5c8 100644 --- a/Console/Program.cs +++ b/Console/Program.cs @@ -86,6 +86,6 @@ 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) { - return 0.0; - } + return Math.Pow(double.Parse(x), double.Parse(y)); + } } From 1c0434a832ab78518aae64225861ec024c7eb9ec Mon Sep 17 00:00:00 2001 From: Yohannes Date: Wed, 25 Mar 2026 21:29:50 -0500 Subject: [PATCH 3/7] Add tests --- Tests/UnitTests.cs | 111 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/Tests/UnitTests.cs b/Tests/UnitTests.cs index a2d3bd18..55f50c7c 100644 --- a/Tests/UnitTests.cs +++ b/Tests/UnitTests.cs @@ -27,3 +27,114 @@ public void Add_Null_Patino() Assert.ThrowsException(() => Program.Add(null, null)); } } +[TestClass] +public class Subtraction +{ + [TestMethod] + public void Subtract_Valid_Patino() + { + Assert.AreEqual(2, Program.Subtract("5", "3")); + Assert.AreEqual(0, Program.Subtract("2", "2")); + Assert.AreEqual(-4, Program.Subtract("3", "7")); + } + + [TestMethod] + public void Subtract_Invalid_Patino() + { + Assert.ThrowsException(() => Program.Subtract("1", "a")); + Assert.ThrowsException(() => Program.Subtract("a", "1")); + Assert.ThrowsException(() => Program.Subtract("a", "a")); + } + + [TestMethod] + public void Subtract_Null_Patino() + { + Assert.ThrowsException(() => Program.Subtract("1", null)); + Assert.ThrowsException(() => Program.Subtract(null, "1")); + Assert.ThrowsException(() => Program.Subtract(null, null)); + } +} + +[TestClass] +public class Multiplication +{ + [TestMethod] + public void Multiply_Valid_Patino() + { + Assert.AreEqual(6, Program.Multiply("2", "3")); + Assert.AreEqual(0, Program.Multiply("0", "5")); + Assert.AreEqual(-12, Program.Multiply("-3", "4")); + } + + [TestMethod] + public void Multiply_Invalid_Patino() + { + Assert.ThrowsException(() => Program.Multiply("1", "a")); + Assert.ThrowsException(() => Program.Multiply("a", "1")); + Assert.ThrowsException(() => Program.Multiply("a", "a")); + } + + [TestMethod] + public void Multiply_Null_Patino() + { + Assert.ThrowsException(() => Program.Multiply("1", null)); + Assert.ThrowsException(() => Program.Multiply(null, "1")); + Assert.ThrowsException(() => Program.Multiply(null, null)); + } +} + +[TestClass] +public class Division +{ + [TestMethod] + public void Divide_Valid_Patino() + { + Assert.AreEqual(2, Program.Divide("6", "3")); + Assert.AreEqual(2.5, Program.Divide("5", "2")); + Assert.AreEqual(-3, Program.Divide("-9", "3")); + } + + [TestMethod] + public void Divide_Invalid_Patino() + { + Assert.ThrowsException(() => Program.Divide("1", "a")); + Assert.ThrowsException(() => Program.Divide("a", "1")); + Assert.ThrowsException(() => Program.Divide("a", "a")); + } + + [TestMethod] + public void Divide_Null_Patino() + { + Assert.ThrowsException(() => Program.Divide("1", null)); + Assert.ThrowsException(() => Program.Divide(null, "1")); + Assert.ThrowsException(() => Program.Divide(null, null)); + } +} + +[TestClass] +public class Exponents +{ + [TestMethod] + public void Power_Valid_Patino() + { + Assert.AreEqual(8, Program.Power("2", "3")); + Assert.AreEqual(25, Program.Power("5", "2")); + Assert.AreEqual(1, Program.Power("7", "0")); + } + + [TestMethod] + public void Power_Invalid_Patino() + { + Assert.ThrowsException(() => Program.Power("1", "a")); + Assert.ThrowsException(() => Program.Power("a", "1")); + Assert.ThrowsException(() => Program.Power("a", "a")); + } + + [TestMethod] + public void Power_Null_Patino() + { + Assert.ThrowsException(() => Program.Power("1", null)); + Assert.ThrowsException(() => Program.Power(null, "1")); + Assert.ThrowsException(() => Program.Power(null, null)); + } +} From 3f05e58febb1d00e78c95cb95079c06b8992d1c2 Mon Sep 17 00:00:00 2001 From: Yohannes Date: Wed, 25 Mar 2026 21:31:36 -0500 Subject: [PATCH 4/7] Add tests fail --- Tests/UnitTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/UnitTests.cs b/Tests/UnitTests.cs index 55f50c7c..04e3a47a 100644 --- a/Tests/UnitTests.cs +++ b/Tests/UnitTests.cs @@ -117,7 +117,7 @@ public class Exponents [TestMethod] public void Power_Valid_Patino() { - Assert.AreEqual(8, Program.Power("2", "3")); + Assert.AreEqual(10, Program.Power("2", "3")); Assert.AreEqual(25, Program.Power("5", "2")); Assert.AreEqual(1, Program.Power("7", "0")); } From 5f2b36ccec1c483a29b579afb1e6d6f3879df1af Mon Sep 17 00:00:00 2001 From: Yohannes Date: Wed, 25 Mar 2026 21:32:26 -0500 Subject: [PATCH 5/7] Pass test --- Tests/UnitTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/UnitTests.cs b/Tests/UnitTests.cs index 04e3a47a..55f50c7c 100644 --- a/Tests/UnitTests.cs +++ b/Tests/UnitTests.cs @@ -117,7 +117,7 @@ public class Exponents [TestMethod] public void Power_Valid_Patino() { - Assert.AreEqual(10, Program.Power("2", "3")); + Assert.AreEqual(8, Program.Power("2", "3")); Assert.AreEqual(25, Program.Power("5", "2")); Assert.AreEqual(1, Program.Power("7", "0")); } From 278811ba7e54413b345e11bfa1fdd22364627e69 Mon Sep 17 00:00:00 2001 From: Yohannes Date: Wed, 25 Mar 2026 21:41:30 -0500 Subject: [PATCH 6/7] Change Names --- Tests/UnitTests.cs | 69 +++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/Tests/UnitTests.cs b/Tests/UnitTests.cs index 55f50c7c..7a27202e 100644 --- a/Tests/UnitTests.cs +++ b/Tests/UnitTests.cs @@ -3,35 +3,36 @@ namespace GithubActionsLab; [TestClass] public class Addition { - [TestMethod] - public void Add_Valid_Patino() - { - Assert.AreEqual(3, Program.Add("1", "2")); - Assert.AreEqual(5, Program.Add("3", "2")); - Assert.AreEqual(12, Program.Add("5", "7")); - } + [TestMethod] + public void Add_Valid_Hailu() + { + Assert.AreEqual(3, Program.Add("1", "2")); + Assert.AreEqual(5, Program.Add("3", "2")); + Assert.AreEqual(12, Program.Add("5", "7")); + } - [TestMethod] - public void Add_Invalid_Patino() - { - Assert.ThrowsException(() => Program.Add("1", "a")); - Assert.ThrowsException(() => Program.Add("a", "1")); - Assert.ThrowsException(() => Program.Add("a", "a")); - } + [TestMethod] + public void Add_Invalid_Hailu() + { + Assert.ThrowsException(() => Program.Add("1", "a")); + Assert.ThrowsException(() => Program.Add("a", "1")); + Assert.ThrowsException(() => Program.Add("a", "a")); + } - [TestMethod] - public void Add_Null_Patino() - { - Assert.ThrowsException(() => Program.Add("1", null)); - Assert.ThrowsException(() => Program.Add(null, "1")); - Assert.ThrowsException(() => Program.Add(null, null)); - } + [TestMethod] + public void Add_Null_Hailu() + { + Assert.ThrowsException(() => Program.Add("1", null)); + Assert.ThrowsException(() => Program.Add(null, "1")); + Assert.ThrowsException(() => Program.Add(null, null)); + } } + [TestClass] public class Subtraction { [TestMethod] - public void Subtract_Valid_Patino() + public void Subtract_Valid_Hailu() { Assert.AreEqual(2, Program.Subtract("5", "3")); Assert.AreEqual(0, Program.Subtract("2", "2")); @@ -39,7 +40,7 @@ public void Subtract_Valid_Patino() } [TestMethod] - public void Subtract_Invalid_Patino() + public void Subtract_Invalid_Hailu() { Assert.ThrowsException(() => Program.Subtract("1", "a")); Assert.ThrowsException(() => Program.Subtract("a", "1")); @@ -47,7 +48,7 @@ public void Subtract_Invalid_Patino() } [TestMethod] - public void Subtract_Null_Patino() + public void Subtract_Null_Hailu() { Assert.ThrowsException(() => Program.Subtract("1", null)); Assert.ThrowsException(() => Program.Subtract(null, "1")); @@ -59,7 +60,7 @@ public void Subtract_Null_Patino() public class Multiplication { [TestMethod] - public void Multiply_Valid_Patino() + public void Multiply_Valid_Hailu() { Assert.AreEqual(6, Program.Multiply("2", "3")); Assert.AreEqual(0, Program.Multiply("0", "5")); @@ -67,7 +68,7 @@ public void Multiply_Valid_Patino() } [TestMethod] - public void Multiply_Invalid_Patino() + public void Multiply_Invalid_Hailu() { Assert.ThrowsException(() => Program.Multiply("1", "a")); Assert.ThrowsException(() => Program.Multiply("a", "1")); @@ -75,7 +76,7 @@ public void Multiply_Invalid_Patino() } [TestMethod] - public void Multiply_Null_Patino() + public void Multiply_Null_Hailu() { Assert.ThrowsException(() => Program.Multiply("1", null)); Assert.ThrowsException(() => Program.Multiply(null, "1")); @@ -87,7 +88,7 @@ public void Multiply_Null_Patino() public class Division { [TestMethod] - public void Divide_Valid_Patino() + public void Divide_Valid_Hailu() { Assert.AreEqual(2, Program.Divide("6", "3")); Assert.AreEqual(2.5, Program.Divide("5", "2")); @@ -95,7 +96,7 @@ public void Divide_Valid_Patino() } [TestMethod] - public void Divide_Invalid_Patino() + public void Divide_Invalid_Hailu() { Assert.ThrowsException(() => Program.Divide("1", "a")); Assert.ThrowsException(() => Program.Divide("a", "1")); @@ -103,7 +104,7 @@ public void Divide_Invalid_Patino() } [TestMethod] - public void Divide_Null_Patino() + public void Divide_Null_Hailu() { Assert.ThrowsException(() => Program.Divide("1", null)); Assert.ThrowsException(() => Program.Divide(null, "1")); @@ -115,7 +116,7 @@ public void Divide_Null_Patino() public class Exponents { [TestMethod] - public void Power_Valid_Patino() + public void Power_Valid_Hailu() { Assert.AreEqual(8, Program.Power("2", "3")); Assert.AreEqual(25, Program.Power("5", "2")); @@ -123,7 +124,7 @@ public void Power_Valid_Patino() } [TestMethod] - public void Power_Invalid_Patino() + public void Power_Invalid_Hailu() { Assert.ThrowsException(() => Program.Power("1", "a")); Assert.ThrowsException(() => Program.Power("a", "1")); @@ -131,10 +132,10 @@ public void Power_Invalid_Patino() } [TestMethod] - public void Power_Null_Patino() + public void Power_Null_Hailu() { Assert.ThrowsException(() => Program.Power("1", null)); Assert.ThrowsException(() => Program.Power(null, "1")); Assert.ThrowsException(() => Program.Power(null, null)); } -} +} \ No newline at end of file From 0f1f76a2abf4d9582ad0394c297a0761820fea2a Mon Sep 17 00:00:00 2001 From: Yohannes Date: Wed, 25 Mar 2026 21:45:29 -0500 Subject: [PATCH 7/7] Update workflow name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 454a18bd..9d1a9477 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: 'Run App YourLastName, YourFirstName' +name: 'Run App Hailu, Yohannes' on: [push, pull_request]