Add WixAssert and SucceededException.
Sean Hall committed
Jul 12, 2020 at 10:31 UTC
1d77b037520a804a1d8f586faad86619b291a1a9
2 files changed
+36
src/WixBuildTools.TestSupport/SucceededException.cs
new
+18
@@ -0,0 +1,18 @@
1
+// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
+
3
+namespace WixBuildTools.TestSupport
4
+{
5
+ using System;
6
+ using Xunit.Sdk;
7
+
8
+ public class SucceededException : XunitException
9
+ {
10
+ public SucceededException(int hr, string userMessage)
11
+ : base(String.Format("WixAssert.Succeeded() Failure\r\n" +
12
+ "HRESULT: 0x{0:X8}\r\n" +
13
+ "Message: {1}",
14
+ hr, userMessage))
15
+ {
16
+ }
17
+ }
18
+}
src/WixBuildTools.TestSupport/WixAssert.cs
new
+18
@@ -0,0 +1,18 @@
1
+// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
+
3
+namespace WixBuildTools.TestSupport
4
+{
5
+ using System;
6
+ using Xunit;
7
+
8
+ public class WixAssert : Assert
9
+ {
10
+ public static void Succeeded(int hr, string format, params object[] formatArgs)
11
+ {
12
+ if (0 > hr)
13
+ {
14
+ throw new SucceededException(hr, String.Format(format, formatArgs));
15
+ }
16
+ }
17
+ }
18
+}