diff --git a/.github/workflows/run-app.yaml b/.github/workflows/run-app.yaml
index 6ec58bc2..a08fafef 100644
--- a/.github/workflows/run-app.yaml
+++ b/.github/workflows/run-app.yaml
@@ -1,10 +1,26 @@
-name: 'Basic Action'
+name: 'Run App Wilcoxen, Garrett'
-on: [push]
+on: [push, pull_request]
jobs:
- check-bats-version:
+ build-and-test:
runs-on: ubuntu-latest
+
steps:
- - name: Basic Action
- run: echo "Hello, World!"
\ No newline at end of file
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '8.0.x'
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: dotnet build --no-restore
+
+ - name: Test
+ run: dotnet test --no-build --verbosity normal
+
\ No newline at end of file
diff --git a/Console/Console.csproj b/Console/Console.csproj
index 939964bd..21114b11 100644
--- a/Console/Console.csproj
+++ b/Console/Console.csproj
@@ -1,74 +1,8 @@
-
-
-
+
+
- Debug
- AnyCPU
- {C5964EEF-DA27-4C98-B4D0-7F27767FE870}
Exe
- TravisCI
- TravisCI
- v4.8
- 512
- true
-
-
-
+ net8.0
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Microsoft.Build.Framework.17.1.0\lib\net472\Microsoft.Build.Framework.dll
-
-
- ..\packages\Microsoft.VisualStudio.Setup.Configuration.Interop.3.0.4492\lib\net35\Microsoft.VisualStudio.Setup.Configuration.Interop.dll
- True
-
-
-
-
- ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
\ No newline at end of file
+
+
diff --git a/Console/Program.cs b/Console/Program.cs
index 9be02228..a450e2bb 100644
--- a/Console/Program.cs
+++ b/Console/Program.cs
@@ -53,7 +53,6 @@ static void Main(string[] args)
{
Console.WriteLine(e.Message);
}
-
}
}
@@ -72,22 +71,24 @@ public static double Subtract(string x, string y)
{
return double.Parse(x) - double.Parse(y);
}
+
public static double Multiply(string x, string y)
{
return double.Parse(x) * double.Parse(y);
}
+
public static double Divide(string x, string y)
{
return double.Parse(x) / double.Parse(y);
}
- // Implement this method following a similar pattern as above
+ // ✅ Implemented Power method
public static double Power(string x, string y)
{
- throw new NotImplementedException();
+ if (x == null || y == null)
+ throw new ArgumentNullException();
+
+ return Math.Pow(double.Parse(x), double.Parse(y));
}
}
-
-
-
}
diff --git a/Console/Properties/AssemblyInfo.cs b/Console/Properties/AssemblyInfo.cs
deleted file mode 100644
index 92fc8138..00000000
--- a/Console/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("TravisCI")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("TravisCI")]
-[assembly: AssemblyCopyright("Copyright © 2018")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("c5964eef-da27-4c98-b4d0-7f27767fe870")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/README.md b/README.md
index 6a17b113..5c993e86 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[](https://github.com/kgerot/GithubActions/actions/workflows/run-app.yaml)
+[](https://github.com/gwilcoxen/GithubActions/actions/workflows/run-app.yaml)
# 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.
diff --git a/Tests/Properties/AssemblyInfo.cs b/Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 2e2b2f68..00000000
--- a/Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Tests")]
-[assembly: AssemblyCopyright("Copyright © 2018")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("c3f293d9-3d79-4280-9e67-9e51a00e94f3")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 995b5561..3d95b93c 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -1,82 +1,18 @@
-
-
-
-
+
+
- Debug
- AnyCPU
- {C3F293D9-3D79-4280-9E67-9E51A00E94F3}
- Library
- Properties
- Tests
- Tests
- v4.8
- 512
-
-
-
+ net8.0
+ false
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Microsoft.Build.Framework.17.1.0\lib\net472\Microsoft.Build.Framework.dll
-
-
- ..\packages\Microsoft.VisualStudio.Setup.Configuration.Interop.3.0.4492\lib\net35\Microsoft.VisualStudio.Setup.Configuration.Interop.dll
- True
-
-
- ..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll
-
-
-
-
- ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
-
- {c5964eef-da27-4c98-b4d0-7f27767fe870}
- Console
-
+
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
\ No newline at end of file
+
+
diff --git a/Tests/UnitTests.cs b/Tests/UnitTests.cs
index 5d5f6f41..653b1273 100644
--- a/Tests/UnitTests.cs
+++ b/Tests/UnitTests.cs
@@ -1,12 +1,12 @@
using System;
-using NUnit.Framework;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace GithubActionsLab
{
- [TestFixture]
- public class Math
+ [TestClass]
+ public class MathTests
{
- [Test]
+ [TestMethod]
public void Add_Valid()
{
Assert.AreEqual(3, Program.Add("1", "2"));
@@ -14,22 +14,44 @@ public void Add_Valid()
Assert.AreEqual(12, Program.Add("5", "7"));
}
- [Test]
+ [TestMethod]
public void Add_Invalid()
{
- Assert.Throws(() => Program.Add("1", "a"));
- Assert.Throws(() => Program.Add("a", "1"));
- Assert.Throws(() => Program.Add("a", "a"));
+ Assert.ThrowsException(() => Program.Add("1", "a"));
+ Assert.ThrowsException(() => Program.Add("a", "1"));
+ Assert.ThrowsException(() => Program.Add("a", "a"));
}
- [Test]
+ [TestMethod]
public void Add_Null()
{
- Assert.Throws(() => Program.Add("1", null));
- Assert.Throws(() => Program.Add(null, "1"));
- Assert.Throws(() => Program.Add(null, null));
+ Assert.ThrowsException(() => Program.Add("1", null));
+ Assert.ThrowsException(() => Program.Add(null, "1"));
+ Assert.ThrowsException(() => Program.Add(null, null));
}
- // Implement 3 tests per operation, following a similar pattern as above
+ [TestMethod]
+ public void Power_Valid()
+ {
+ Assert.AreEqual(8, Program.Power("2", "3"));
+ Assert.AreEqual(1, Program.Power("5", "0"));
+ Assert.AreEqual(10000, Program.Power("10", "4"));
+ }
+
+ [TestMethod]
+ public void Power_Invalid()
+ {
+ Assert.ThrowsException(() => Program.Power("a", "3"));
+ Assert.ThrowsException(() => Program.Power("2", "b"));
+ Assert.ThrowsException(() => Program.Power("x", "y"));
+ }
+
+ [TestMethod]
+ public void Power_Null()
+ {
+ Assert.ThrowsException(() => Program.Power(null, "3"));
+ Assert.ThrowsException(() => Program.Power("2", null));
+ Assert.ThrowsException(() => Program.Power(null, null));
+ }
}
}