-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathSetupInstanceTests.cs
More file actions
30 lines (24 loc) · 1.07 KB
/
SetupInstanceTests.cs
File metadata and controls
30 lines (24 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
namespace ServiceControlInstaller.Engine.UnitTests.Setup;
using System;
using System.Threading;
using Engine.Setup;
using NUnit.Framework;
[TestFixture]
public class SetupInstanceTests
{
[Test]
public void Should_not_throw_on_0_exit_code() => Assert.DoesNotThrow(() => InstanceSetup.Run(TestContext.CurrentContext.WorkDirectory, "SetupProcessFake.exe", "test", ""));
[Test]
public void Should_capture_and_rethrow_failures()
{
var ex = Assert.Throws<Exception>(() => InstanceSetup.Run(TestContext.CurrentContext.WorkDirectory, "SetupProcessFake.exe", "test", "fail"));
Assert.That(ex.Message, Does.Contain("Fake exception"));
}
[Test]
public void Should_capture_and_rethrow_non_zero_exit_codes()
{
var ex = Assert.Throws<Exception>(() => InstanceSetup.Run(TestContext.CurrentContext.WorkDirectory, "SetupProcessFake.exe", "test", "non-zero-exit-code"));
Assert.That(ex.Message, Does.Contain("returned a non-zero exit code: 3"));
Assert.That(ex.Message, Does.Contain("Fake non zero exit code message"));
}
}