forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValidateCommand.cs
More file actions
84 lines (77 loc) · 3.55 KB
/
Copy pathValidateCommand.cs
File metadata and controls
84 lines (77 loc) · 3.55 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// -----------------------------------------------------------------------------
// <copyright file="ValidateCommand.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
// -----------------------------------------------------------------------------
namespace AppInstallerCLIE2ETests
{
using AppInstallerCLIE2ETests.Helpers;
using NUnit.Framework;
/// <summary>
/// Test validate command.
/// </summary>
public class ValidateCommand : BaseCommand
{
/// <summary>
/// Test validate manifest.
/// </summary>
[Test]
public void ValidateManifest()
{
var result = TestCommon.RunAICLICommand("validate", TestCommon.GetTestDataFile("Manifests\\TestValidManifest.yaml"));
Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode);
Assert.True(result.StdOut.Contains("Manifest validation succeeded."));
}
/// <summary>
/// Test validate manifest with extended characters.
/// </summary>
[Test]
public void ValidateManifestWithExtendedCharacter()
{
var result = TestCommon.RunAICLICommand("validate", TestCommon.GetTestDataFile("Manifests\\TëstExeInstaller.yaml"));
Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode);
Assert.True(result.StdOut.Contains("Manifest validation succeeded."));
}
/// <summary>
/// Test validate invalid manifest.
/// </summary>
[Test]
public void ValidateInvalidManifest()
{
var result = TestCommon.RunAICLICommand("validate", TestCommon.GetTestDataFile("Manifests\\TestInvalidManifest.yaml"));
Assert.AreEqual(Constants.ErrorCode.ERROR_MANIFEST_VALIDATION_FAILURE, result.ExitCode);
Assert.True(result.StdOut.Contains("Manifest validation failed."));
}
/// <summary>
/// Test validate manifest with warnings.
/// </summary>
[Test]
public void ValidateManifestWithWarnings()
{
var result = TestCommon.RunAICLICommand("validate", TestCommon.GetTestDataFile("Manifests\\TestWarningManifest.yaml"));
Assert.AreEqual(Constants.ErrorCode.ERROR_MANIFEST_VALIDATION_WARNING, result.ExitCode);
Assert.True(result.StdOut.Contains("Manifest validation succeeded with warnings."));
}
/// <summary>
/// Test validate manifest with warnings suppressed.
/// </summary>
[Test]
public void ValidateManifestSuppressWarnings()
{
var result = TestCommon.RunAICLICommand("validate", TestCommon.GetTestDataFile("Manifests\\TestWarningManifest.yaml") + " --ignore-warnings");
Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode);
Assert.False(result.StdOut.Contains("Manifest validation succeeded with warnings."));
Assert.True(result.StdOut.Contains("Manifest validation succeeded."));
}
/// <summary>
/// Test validate manifest that doesn't exist.
/// </summary>
[Test]
public void ValidateManifestDoesNotExist()
{
var result = TestCommon.RunAICLICommand("validate", TestCommon.GetTestDataFile("Manifests\\DoesNotExist"));
Assert.AreEqual(Constants.ErrorCode.ERROR_PATH_NOT_FOUND, result.ExitCode);
Assert.True(result.StdOut.Contains("Path does not exist"));
}
}
}