Skip to content

Commit b4cc1b4

Browse files
committed
Fix broken test in CI.
1 parent 0b2f710 commit b4cc1b4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ConsoleHero.Test/BeepHelperTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using ConsoleHero.Helpers;
22
using ConsoleHero.Interfaces;
33
using Moq;
4+
using System.Diagnostics;
45

56
namespace ConsoleHero.Test;
67

@@ -59,14 +60,19 @@ public void Beep_MacOSPlatform_StartsProcess()
5960
[TestMethod]
6061
public void Beep_NonWindowsPlatformWithException_WritesBellCharacter()
6162
{
63+
Mock<IProcessRunner> processRunnerMock = new();
64+
processRunnerMock.Setup(p => p.Start(It.IsAny<ProcessStartInfo>())).Throws(new InvalidOperationException());
65+
6266
_platformHelperMock.Setup(p => p.IsWindows).Returns(false);
6367
_platformHelperMock.Setup(p => p.IsLinux).Returns(true);
6468
using ConsoleOutput consoleOutput = new();
6569

66-
// Act
6770
_beepHelper.Beep(1000, 500);
6871

69-
// Assert
7072
Assert.AreEqual("\a", consoleOutput.GetOutput());
7173
}
74+
public interface IProcessRunner
75+
{
76+
void Start(ProcessStartInfo startInfo);
77+
}
7278
}

0 commit comments

Comments
 (0)