Skip to content

Rename UnitTests class to UnitsTests and remove duplicate test#302

Merged
samsmithnz merged 2 commits intomainfrom
copilot/rename-unittests-class
Dec 5, 2025
Merged

Rename UnitTests class to UnitsTests and remove duplicate test#302
samsmithnz merged 2 commits intomainfrom
copilot/rename-unittests-class

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 5, 2025

Class name UnitTests was inconsistent with file name UnitsTests.cs, and contained a misplaced CountSkittlesInAUSCupTest that duplicated an existing test in SkittleTests.cs.

  • Renamed class UnitTestsUnitsTests to match file name
  • Removed duplicate CountSkittlesInAUSCupTest (identical test exists in SkittleTests.cs)
  • Removed unused using System; directive
Original prompt
Please apply the following diffs and create a pull request.
Once the PR is ready, give it a title based on the messages of the fixes being applied.

[{"message":"Class name 'UnitTests' is ambiguous and inconsistent with the file name 'UnitsTests.cs'. Consider renaming to 'UnitsTests' to match the file name and be more descriptive about testing the Units class.","fixFiles":[{"filePath":"src/MandMCounter.Tests/UnitsTests.cs","diff":"diff --git a/src/MandMCounter.Tests/UnitsTests.cs b/src/MandMCounter.Tests/UnitsTests.cs\n--- a/src/MandMCounter.Tests/UnitsTests.cs\n+++ b/src/MandMCounter.Tests/UnitsTests.cs\n@@ -7,7 +7,7 @@\n {\n     [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n     [TestClass]\n-    public class UnitTests\n+    public class UnitsTests\n     {\n         [TestMethod]\n         public void GetUnitsForVolumeTest()\n"}]},{"message":"This test method is misplaced in the UnitsTests class. It tests Calculator.CountSkittles() functionality which belongs in SkittleTests.cs where similar tests already exist.","fixFiles":[{"filePath":"src/MandMCounter.Tests/UnitsTests.cs","diff":"diff --git a/src/MandMCounter.Tests/UnitsTests.cs b/src/MandMCounter.Tests/UnitsTests.cs\n--- a/src/MandMCounter.Tests/UnitsTests.cs\n+++ b/src/MandMCounter.Tests/UnitsTests.cs\n@@ -37,19 +37,6 @@\n             Assert.IsFalse(string.IsNullOrEmpty(results[0]));\n         }\n \n-        [TestMethod]\n-        public void CountSkittlesInAUSCupTest()\n-        {\n-            //Arrange\n-            string unit = \"Cup\";\n-            float quantity = 1f;\n \n-            //Act\n-            float result = Calculator.CountSkittles(unit, quantity);\n-\n-            //Assert\n-            Assert.AreEqual(212, (int)Math.Round(result, 0));\n-        }\n-\n     }\n }\n"}]},{"message":"The assertion uses a different pattern than similar tests in SkittleTests.cs which use 'Assert.AreEqual(212f, System.Math.Round(result, 0), 1f)'. This inconsistency makes the test suite harder to maintain.","fixFiles":[{"filePath":"src/MandMCounter.Tests/UnitsTests.cs","diff":"diff --git a/src/MandMCounter.Tests/UnitsTests.cs b/src/MandMCounter.Tests/UnitsTests.cs\n--- a/src/MandMCounter.Tests/UnitsTests.cs\n+++ b/src/MandMCounter.Tests/UnitsTests.cs\n@@ -48,7 +48,7 @@\n             float result = Calculator.CountSkittles(unit, quantity);\n \n             //Assert\n-            Assert.AreEqual(212, (int)Math.Round(result, 0));\n+            Assert.AreEqual(212f, Math.Round(result, 0), 1f);\n         }\n \n     }\n"}]}]

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…est method

Co-authored-by: samsmithnz <8389039+samsmithnz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ambiguous class name in UnitsTests Rename UnitTests class to UnitsTests and remove duplicate test Dec 5, 2025
Copilot AI requested a review from samsmithnz December 5, 2025 02:47
@samsmithnz samsmithnz marked this pull request as ready for review December 5, 2025 11:45
@samsmithnz samsmithnz enabled auto-merge December 5, 2025 11:45
@samsmithnz samsmithnz merged commit 0dc0b34 into main Dec 5, 2025
10 checks passed
@samsmithnz samsmithnz deleted the copilot/rename-unittests-class branch December 5, 2025 11:47
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 5, 2025

Pull Request Test Coverage Report for Build 19950924058

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 71.815%

Totals Coverage Status
Change from base Build 19941810687: 0.0%
Covered Lines: 96
Relevant Lines: 99

💛 - Coveralls

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 5, 2025

Pull Request Test Coverage Report for Build 19950924008

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 71.815%

Totals Coverage Status
Change from base Build 19941810687: 0.0%
Covered Lines: 96
Relevant Lines: 99

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants