Skip to content

Commit 16fe7b7

Browse files
CopilotMalcolmnixon
andcommitted
Split tests into ProgramTests and IntegrationTests
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
1 parent c98c57d commit 16fe7b7

File tree

2 files changed

+62
-52
lines changed

2 files changed

+62
-52
lines changed

test/DemaConsulting.DotnetToolWrapper.Tests/DotnetToolWrapperTests.cs renamed to test/DemaConsulting.DotnetToolWrapper.Tests/IntegrationTests.cs

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
namespace DemaConsulting.DotnetToolWrapper.Tests;
66

77
/// <summary>
8-
/// Tests for the DotnetToolWrapper application
8+
/// Integration tests for the DotnetToolWrapper application
99
/// </summary>
1010
[TestClass]
11-
public class DotnetToolWrapperTests
11+
public class IntegrationTests
1212
{
1313
/// <summary>
1414
/// Test setup directory
@@ -57,7 +57,7 @@ public void TestCleanup()
5757
/// <returns>Path to DLL</returns>
5858
private static string GetDotnetToolWrapperDllPath()
5959
{
60-
var assemblyLocation = Path.GetDirectoryName(typeof(DotnetToolWrapperTests).Assembly.Location);
60+
var assemblyLocation = Path.GetDirectoryName(typeof(IntegrationTests).Assembly.Location);
6161
Assert.IsNotNull(assemblyLocation, "Assembly location should not be null");
6262
return Path.Combine(assemblyLocation, "DemaConsulting.DotnetToolWrapper.dll");
6363
}
@@ -250,53 +250,4 @@ public void TestBadConfiguration()
250250
Assert.AreEqual(1, exitCode, "Exit code should be 1 for bad configuration");
251251
Assert.IsTrue(output.Contains("Bad configuration"), "Output should mention bad configuration");
252252
}
253-
254-
/// <summary>
255-
/// Test GetOs method returns valid OS identifier
256-
/// </summary>
257-
[TestMethod]
258-
public void TestGetOs()
259-
{
260-
// Act
261-
var os = Program.GetOs();
262-
263-
// Assert
264-
Assert.IsNotNull(os);
265-
Assert.IsTrue(
266-
os is "win" or "linux" or "freebsd" or "osx" or "unknown",
267-
$"OS should be one of the known values, got: {os}");
268-
}
269-
270-
/// <summary>
271-
/// Test GetArchitecture method returns valid architecture identifier
272-
/// </summary>
273-
[TestMethod]
274-
public void TestGetArchitecture()
275-
{
276-
// Act
277-
var arch = Program.GetArchitecture();
278-
279-
// Assert
280-
Assert.IsNotNull(arch);
281-
Assert.IsTrue(
282-
arch is "x86" or "x64" or "arm" or "arm64" or "wasm" or "s390x" or "unknown",
283-
$"Architecture should be one of the known values, got: {arch}");
284-
}
285-
286-
/// <summary>
287-
/// Test GetTarget method returns valid target string
288-
/// </summary>
289-
[TestMethod]
290-
public void TestGetTarget()
291-
{
292-
// Act
293-
var target = Program.GetTarget();
294-
295-
// Assert
296-
Assert.IsNotNull(target);
297-
Assert.IsTrue(target.Contains('-'), "Target should contain a hyphen");
298-
299-
var parts = target.Split('-');
300-
Assert.AreEqual(2, parts.Length, "Target should have exactly two parts");
301-
}
302253
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
3+
namespace DemaConsulting.DotnetToolWrapper.Tests;
4+
5+
/// <summary>
6+
/// Unit tests for the Program class methods
7+
/// </summary>
8+
[TestClass]
9+
public class ProgramTests
10+
{
11+
/// <summary>
12+
/// Test GetOs method returns valid OS identifier
13+
/// </summary>
14+
[TestMethod]
15+
public void TestGetOs()
16+
{
17+
// Act
18+
var os = Program.GetOs();
19+
20+
// Assert
21+
Assert.IsNotNull(os);
22+
Assert.IsTrue(
23+
os is "win" or "linux" or "freebsd" or "osx" or "unknown",
24+
$"OS should be one of the known values, got: {os}");
25+
}
26+
27+
/// <summary>
28+
/// Test GetArchitecture method returns valid architecture identifier
29+
/// </summary>
30+
[TestMethod]
31+
public void TestGetArchitecture()
32+
{
33+
// Act
34+
var arch = Program.GetArchitecture();
35+
36+
// Assert
37+
Assert.IsNotNull(arch);
38+
Assert.IsTrue(
39+
arch is "x86" or "x64" or "arm" or "arm64" or "wasm" or "s390x" or "unknown",
40+
$"Architecture should be one of the known values, got: {arch}");
41+
}
42+
43+
/// <summary>
44+
/// Test GetTarget method returns valid target string
45+
/// </summary>
46+
[TestMethod]
47+
public void TestGetTarget()
48+
{
49+
// Act
50+
var target = Program.GetTarget();
51+
52+
// Assert
53+
Assert.IsNotNull(target);
54+
Assert.IsTrue(target.Contains('-'), "Target should contain a hyphen");
55+
56+
var parts = target.Split('-');
57+
Assert.AreEqual(2, parts.Length, "Target should have exactly two parts");
58+
}
59+
}

0 commit comments

Comments
 (0)